RedisJSON Support #2617
Closed
vanessa-dev
started this conversation in
General
Replies: 3 comments
-
We don't have implementations for each of the try {
$redis = new Redis();
$redis->connect('127.0.0.1', 7200);
} catch (RedisException $e) {
die("Connection failed: " . $e->getMessage());
}
$data = [
'name' => 'Alice',
'age' => 30,
'skills' => ['PHP', 'Redis', 'JSON']
];
$setResult = $redis->rawCommand('JSON.SET', 'user:123', '.', json_encode($data));
$jsonData = $redis->rawCommand('JSON.GET', 'user:123', '.');
$result = json_decode($jsonData, true);
print_r($result);
$redis->close(); You could also use the Relay client which we also write. It has specific support for |
Beta Was this translation helpful? Give feedback.
0 replies
-
You said that you do not have the implementations of each of the commands so there any of the` ` RedisJSON` commands ` that phpredis has implementations or the only way it is just using the `rawCommand.`
…________________________________
De: Michael Grunder ***@***.***>
Enviado: terça-feira, 28 de janeiro de 2025 14:46
Para: phpredis/phpredis ***@***.***>
Cc: Vanessa Santana ***@***.***>; Author ***@***.***>
Assunto: Re: [phpredis/phpredis] RedisJSON Support (Discussion #2617)
We don't have implementations for each of the reJson commands but you can use rawCommand to execute any arbitrary command you like, including these.
try {
$redis = new Redis();
$redis->connect('127.0.0.1', 7200);
} catch (RedisException $e) {
die("Connection failed: " . $e->getMessage());
}
$data = [
'name' => 'Alice',
'age' => 30,
'skills' => ['PHP', 'Redis', 'JSON']
];
$setResult = $redis->rawCommand('JSON.SET', 'user:123', '.', json_encode($data));
$jsonData = $redis->rawCommand('JSON.GET', 'user:123', '.');
$result = json_decode($jsonData, true);
print_r($result);
$redis->close();
You could also use the Relay<https://relay.so/> client which we also write. It has specific support for reJson. Relay is free to use although not open source like PhpRedis.
—
Reply to this email directly, view it on GitHub<#2617 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMQ3ZNIOF3D77H4HKKIIFJD2M667FAVCNFSM6AAAAABWBAGICKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOJYG4YDSMQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I take a look on the extension documentation I did not find any content related to RedisJSON, there any way that i can do that with the extension https://redis.io/glossary/json-storage/
Beta Was this translation helpful? Give feedback.
All reactions