Monday, 26 August 2013

memcache - searching key names containing multiple identifiers

memcache - searching key names containing multiple identifiers

I'm new to memcache (via Amazon ElastiCache) and I'm using it to store
data to offload some work from the database.
Currently I store 2 identical values where the key is a different lookup key.
For example:
// each key represents the user email address with the value a json dump
of the user record
'email@email.com': {
id: 1,
name: 'John Doe',
email: 'email@email.com'
}
// each key represents the user id with the value a json dump of the user
record
1: {
id: 1,
name: 'John Doe',
email: 'email@email.com'
}
Is it possible to store both the id/email in one key thus eliminating the
need for 2 separate records stored in memory?
Any example in either Python or PHP would be most helpful!

No comments:

Post a Comment