Code Monkey home page Code Monkey logo

redislabs-rejson's People

Contributors

mkorkmaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

redislabs-rejson's Issues

MODULE command don't work

Hello, I'm getting this error found in the constructor

Argument 1 passed to Redislabs\Module\RedisJson\RedisJson::setModuleVersion() must be of the type array, string given, called in C:\wamp64\www\aizen_themes\vendor\mkorkmaz\redislabs-rejson\src\RedisJson\RedisJson.php

at this line $this->setModuleVersion($redisClient->rawCommand('MODULE', ['LIST']));

when I comment, all the logic related to moduleVersion everything works fine

this is how i init the RedisJson

$redis = new Predis\Client('tcp://myrediscloudremoteurl:port' );
$redisJson = RedisJson::createWithPredis($redis);

Set is not working

when using ->set() its not creating the entry however get() works as expected ...

Not support OPT_PREFIX ?

Hi:

redis set OPT_PREFIX,but rejson not support. code:

$redis = new \Redis();
$redis->connect('localhost', 6379);
$redis->setOption(\Redis::OPT_PREFIX, 'love');
$redis->select(1);
$reJSON = \Redislabs\Module\ReJSON\ReJSON::createWithPhpRedis($redis);
$reJSON->set('doc1', '$', ['foo'=>'bar']);
var_dump($reJSON->get('doc'));

$redis->set('doc2', 'blablabla...');
var_dump($redis->get('doc2'));
var_dump($reJSON->exists('doc'), $redis->exists('doc2'));

json_encode / json_decode should be optional

Hi @mkorkmaz!

Thanks for this library. I was wondering if the json enconding and decoding could be optional: i.e. to store json strings and be able to return them as they are --this is very handy for caching json responses to be consumed by API.

Cheers!

Calling mget only works as $reJson->mget(...$keys, ...['.']);

About the signature of ReJSON::mget and calling it with arguments, the only way i could make it work is as follows:

$keys = ['key:1', 'key:2', 'key:3'];

$reJson->mget(...$keys, ...['.']);

The reason for ...['.'] is because when calling mget(...$keys, '.') i get the following error: Cannot use positional argument after argument unpacking. Running PHP 7.4

Inspecting the source of MultipleGet::createCommandWithArguments found that it's because of this snippet:

$path = array_pop($arguments);
$keys = $arguments;
return new self(
  $keys,
  new Path($path)
);

When calling the code with $reJson->mget($keys, '.') it ends up with this:

array:2 [
  "path" => "."
  "keys" => array:1 [
    0 => array:3 [
      0 => "key:1"
      1 => "key:2"
      2 => "key:3"
    ]
  ]
]

When instead it should have been:

array:2 [
  "path" => "."
  "keys" => array:3 [
    0 => "key:1"
    1 => "key:2"
    2 => "key:3"
  ]
]

This can be easily solved by replacing $keys = $arguments; with $keys = array_pop($arguments);.

  1. Is it intentional for the signature to be called as such with variables? $reJson->mget(...$keys, ...['.']);
  2. If not, i'd be happy to open a PR with this change. How about that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.