Re:Samsung Announces Key-Value SSD Prototype
by IfOnlyYouKnew on Thursday September 05, 2019 @07:45PM
(#20891662)
Yes, Redis requires more manual tracking of such things. What you have to understand is that it is incredibly fast: You can easily do hundred of thousands of sismember lookups within the time it takes to serve a usual request.
> or is everyone just ignoring all non-str datatypes and storing everything as JSON
I doubt it. I've been surprised by how many of the datatypes I have found uses for.
Re:Samsung Announces Key-Value SSD Prototype
by Dylan16807 on Friday September 06, 2019 @12:28AM
(#20893070)
I'd guess that most people don't see a sentinel value to distinguish between empty and unknown as a serious problem.
Re:Samsung Announces Key-Value SSD Prototype
by JoachimSchipper on Saturday September 07, 2019 @01:37PM
(#20905271)
Supposedly you can use a Lua script - although that’s a somewhat big hammer for such a simple problem...
Suppose I have some function, get_members_of_group(dt, groupname). It returns a set of strings. There are arbitrarily many groups, so I can't just cache all of them in one key. Someone might make a new group at any time, and groups are never deleted or changed, they just age out.
So far, this seems great. I make get_members_of_group_from_redis() first check redis for a key group_members_{dt}_{name}. If it's there, return it. If it's not, get it, cache it, return it.
But groups can also be empty.
Redis doesn't let me store an empty set. If a group comes back empty, the fact that it's empty can't be cached because you can't tell the difference between "not cached yet" and "cached but empty".
I've googled it a bit and all of the workarounds (sentinel key/value pair, storing "empty" at that key so the SMEMBERS fails with an error, etc) are hacky and make me not want to use Redis.
Is this a me problem and everyone is OK with slamming their db with hits if a cached function returns empty, or is everyone just ignoring all non-str datatypes and storing everything as JSON? Or is it just that weird to have a function that might return an empty set that nobody else has this problem?