Instead of storing (for example) 'users:john', I store 'users:john:',
notice the trailing colon. Whenever I need to delete a set of items,
I throw the 'to delete' root key (in this case 'users:john:') into a
list. When deleting, I either generate the list of keys from known
suffixes of the root key, or in some cases, just use KEYS with a
wildcard, and pass that to delete.
Regards,
- Josiah
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
>
>
> Instead of storing (for example) 'users:john', I store 'users:john:',
> notice the trailing colon. Whenever I need to delete a set of items,
> I throw the 'to delete' root key (in this case 'users:john:') into a
> list. When deleting, I either generate the list of keys from known
> suffixes of the root key, or in some cases, just use KEYS with a
> wildcard, and pass that to delete.
Using KEYS pattern in such fashion can lend to performance issues,
remember that it will put Redis to walk the *whole* keyspace.
--
Aníbal Rojas
Ruby on Rails Web Developer
http://www.google.com/profiles/anibalrojas
- Josiah
2010/7/11 Aníbal Rojas <aniba...@gmail.com>:
Since you say that the problem is about clients that don't finish
their task, I think you'll agree that performing the necessary deletes
is not Redis' concern but your application's.
If you want to make sure your application finishes a group of
operations, use MULTI/EXEC:
http://code.google.com/p/redis/wiki/MultiExecCommand. If your client
dies while running these commands, they won't be executed at all, so
you won't end up with inconsistent data.
No, when you run MULTI, all subsequent commands are queued on the
server. Only when you run EXEC do those commands actually execute.
Makes sense?
Which does essentially provide the same functionality, in that no
other clients will see your updates, because the commands will be
executed in "isolation" because Redis is single-threaded. So it
depends on your definition of isolation, I suppose, but should most
likely give you what you need.
You can actually have any number of concurrent connections to Redis, but being single threaded means that no "read' command will be executed while your multi/exec is being executed. And yes, _any_ slow command execution can severy affect performance queuein all of the subsequent commands until it finishes.
On Jul 13, 2010 5:16 AM, "teleo" <lev....@gmail.com> wrote:
Thanks, everybody.
I need to clarify one thing, though. The fact that Redis is single-
threaded does not *on its own* mean that requests from other clients
are not executed. Some event-driven implementations implement a kind
of cooperative multi-tasking, so that other clients are not blocked
for too long.
My question is: when the queued commands are finally EXECuted is it
guaranteed that no clients sees any intermediate state -- any state
after EXEC started but before it ended?
If so, there is good isolation. The down side, however, is that very
large MULTI-EXECs could cause throughput problems.
On Jul 13, 6:32 am, Mason Jones <masono...@gmail.com> wrote:
> On Mon, Jul 12, 2010 at 6:07 PM, Damian Janowski <djanow...@dimaion.com> wrote:
> > On Mon, Jul 12...