mkorkmaz / redislabs-rejson Goto Github PK
View Code? Open in Web Editor NEWRedislabs RedisJson aka ReJson Client for PHP (PHP 7.3+)
Home Page: https://oss.redislabs.com/redisjson/
License: MIT License
Redislabs RedisJson aka ReJson Client for PHP (PHP 7.3+)
Home Page: https://oss.redislabs.com/redisjson/
License: MIT License
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);
我们的redis是集群 代码用的是RedisCluster类 有什么办法可以适配么
Our Redis is a cluster
The code uses the RedisCluster class
Is there any way to adapt
when using ->set() its not creating the entry however get() works as expected ...
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'));
Please notice all the commands can now get full jsonpath, i.e. dynamic paths that start with a $ sign.
As a result all the commands can now return multi parts of the JSON.
see: https://oss.redis.com/redisjson/commands/
I am using Laravel v10 and want to use this library. It would be of great help if some example is shown.
Hi,
how set key with expire/timeout?
Please add to composer.json "php": "^7.2 | ^8.0"
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!
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 callingmget(...$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);
.
$reJson->mget(...$keys, ...['.']);
Have created a pull request on this :
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.