2

I'm pretty new to redis and Nosql databases in general. I have a few questions in my mind. I'm writing some codes to test out redis with the library Rediska and I want to see how redis stores the values in the database. I'm really confused my question is:

If I store some values in the database, how can I access them through the redis cli? Is there any command that can list all the lists?

For example, I'm testing the retwitter app that comes with the rediska library:

$userData = $form->getValues();
$userData['id'] = User::fetchNextId();

// save user
$user = new User($userData['id']);
$user->setValue($userData);

$users = new Users();
$users->add($userData['id']);

After the last instruction, the userid is saved to the db. I want to query redis with its client to see it. How can i do that ?

1 Answer 1

2

You can always check all keys stored in the database, using the KEYS command (in this case, keys *).

After you find a key to inspect, using TYPE will retrieve the type of the key. Beware of case (i.e. User and user are different keys).

Based on the type, you now can filter the full command list to find the ones to issue against that type.

Now browsing the Rediska example, Users is a subclass of Rediska_Key_Set, so in Redis the structure is a SET. You can query sets using these commands.

(for instance, SMEMBERS [keyName] will list all members of the set).

Finally, you can always call the MONITOR command in redis-cli, and then access the application. Every command issued against Redis will then be dumped on the screen.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.