Z
Z
zlodiak2019-12-05 15:56:17
Python
zlodiak, 2019-12-05 15:56:17

Where does the Python redis package store data?

I installed a redis server and am trying to use it through the python package redis==3.3.11

(redis-py) [email protected] ~/.MINT18/code/python/redis-py $ python
Python 3.8.0 (default, Oct 14 2019, 23:13:30) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>> r = redis.Redis()
>>> r.mset({'Croatia': 'Zagreb', 'Bahams': 'Nassau'})
True
>>> r.get('Bahams')
b'Nassau'
>>> exit

then I exited the REPL, as you can see. And, running the REPL again, tried to display the previously written value:
(redis-py) [email protected] ~/.MINT18/code/python/redis-py $ python
Python 3.8.0 (default, Oct 14 2019, 23:13:30) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>> r = redis.Redis()
>>> r.get("Bahamas")
>>>

and received nothing in response.
Please tell me why is this happening? Are all written key-values ​​stored only within the REPL session? What about redis then?
Moreover, it can also be called with parameters if desired:
# Из redis/client.py
class Redis(object):
    def __init__(self, host='localhost', port=6379,
                 db=0, password=None, socket_timeout=None,
                 # ...

That is, there is a connection with the server

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2019-12-05
@zlodiak

Bahams != Bahamas, check the data already, not the first time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question