Skip to content

Instantly share code, notes, and snippets.

@jimmyjacobson
Created January 21, 2012 03:33
Show Gist options
  • Save jimmyjacobson/1651125 to your computer and use it in GitHub Desktop.
Save jimmyjacobson/1651125 to your computer and use it in GitHub Desktop.
Doing weird stuff with Redis
Let's start with some people
vegastech:people:person:raycmorgan {
name: Ray Morgan
}
vegastech:people:person:jimmyjacobson {
name: Jimmy
}
vegastech:people:markjohnsoncc {
name: mark j
}
Now let's add a place for them to hang out
vegastech:locations:location:1 {
name: usrlib,
address: fremont
}
And finally some events
vegastech:events:event:1 {
location: vegastech:locations:location:1
name: jelly
date: 2012-02-01
}
vegastech:events:event:2 {
location: vegastech:locations:location:1
name: nodejs meetup
date: 2012-02-01
}
Let's tag everything that has to do with nodes in the system, 2 people and one event:
vegastech:tags:nodejs [ 'vegastech:events:event:2', 'vegastech:people:person:raycmorgan', 'vegastech:people:person:jimmyjacobson' ]
And everything that has to do with Jelly, 3 people, one event and two locations:
vegastech:tags:jelly ['vegastech:events:event:1', 'vegastech:locations:location:1', 'vegastech:people:person:raycmorgan', 'vegastech:people:person:jimmyjacobson', 'vegastech:people:markjohnsoncc']
Now imagine performing intersections and unions on these sets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment