Forums

redislite not always working

Hey there,

I'm using redislite to store translations of my questionnaire app with the following config:


redis_connection = Redis('/tmp/redis.db')

redis_url = redis_connection.socket_file

cache = Cache(app, config={'CACHE_TYPE': 'RedisCache', 'CACHE_REDIS_URL': f'unix://{redis_url}', 'CACHE_DEFAULT_TIMEOUT': 3600})


However, sometimes this does not seem to store the key-value-pairs correctly (or not at all). It usually works and stores the translated text as the key and the original text as the value. When submitting the translated text, I then retrieve the original text and store it in the DB. This works most of the time.


But sometimes it just stores the translated text, as it cannot retrieve the data from redis somehow. I'm setting and retrieving the data like so:

cache.set('translations', dict(zip(questions['Fragen, Hinweise und Items'], original_questions)))

translations = cache.get('translations') or {}


Is this related to some way you handle the workers? Or am I doing something wrong in my configuration? The timeout does not seem to be the error as some users finish the questionnaire in 15 minutes and their data is stored incorrectly... Or is there a limit to the characters within redislite?

Any help is appreciated, thanks!

Viktor

See https://help.pythonanywhere.com/pages/GlobalStateAndWebApps/