私は (Amazon ElastiCache 経由で) memcache を初めて使用し、データを保存してデータベースから作業をオフロードするために使用しています。
現在、キーが異なるルックアップキーである2つの同一の値を保存しています。
例えば:
// 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'
}
id/email の両方を 1 つのキーに保存して、メモリに 2 つの別々のレコードを保存する必要をなくすことはできますか?
Python または PHP のいずれかの例が最も役に立ちます。