1

Trying to build a data set of two cache tables (which are currently stored in SQL Server) - one is the actual cache table (CacheTBL); the other is the staging table (CacheTBL_Staging).

The table structure has two columns - "key", "value"

So I'm wondering how to implement this in Redis as I'm a total noob to this NoSQL stuff. Should I use a SET or LIST? Or something else?

Thank you so much in advance!

asked Jul 15, 2016 at 20:35

1 Answer 1

1

You need to decide whether you want separate REDIS keys for all entries using SET and GET, or put them into hashes with HSET and HGET. If you use the first approach, your keys should include a prefix to distinguish between main and staging. If you use hashes, this is not necessary, because the hash name can also be used to distinguish these. You probably also need to decide how you want to check for cache validity, and what your cache flushing strategy should be. This normally requires some additional data structures in REDIS.

answered Jul 15, 2016 at 20:44
Sign up to request clarification or add additional context in comments.

3 Comments

So if I were to use HSET & HGET, it would look something like this: HSET myCacheHash key1 value1 HSET myCacheHash_Staging key2 value2 where the myCacheHash & myCacheHash_Staging are kinda like the sql server table names - CacheTBL & CacheTBL_Staging?
Yes that's the idea. You should probably experiment with other options, too. For example, you could store a hash for each key, containing sub-keys "main" and "staging", if that fits you usage.
Thank you @Hans-Martin!!

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.