I have a collection of films, about 150 thousand, and I have several playlists where several films appear several times.
I want to cache movies and playlists on the Redis.
What I needed would be for the playlists to save only references to the movies, so when I retrieve a playlist it will bring the referenced films, but that if I change a movie it will be changed in all playlists.
I didn't want to retrieve the playlist with only ids and then have to retrieve each movie by id again, is there a way to do this directly in one query? as if it were a pointer ...
Thanks!
As I see it you have 2 options:
Use RedisGears (https://github.com/RedisGears/RedisGears). In a single python line you can do exactly what you need and it will work perfectly on cluster. It will look something like this (assuming playlist is a redis list of movies located in redis hashes):
GB().flatmap(lambda r: r).repartition(lambda r:r).map(lambda r: execute('hgetall', r)).run('< playlist_key_name >')