I'm using Redis as a cache service (Key=>Value) @ AWS ElastiCache.
I want to save an object which contains nested objects inside the cache:
- Object1 - contains instance of Object2
I'm obviously serialising my objects - let's say to JSON for that matter - so my serialised object looks like this:
{
"property1":"property1",
"property2":"property2",
"property2":"property3",
"object2":{
object2
}
}
I'm wondering what will be the best practice from the following options:
- Store under my key the whole object1 as a full JSON.
- Store object2 with its own key and in my object1 serialisation to put object2 key as a reference, and when pulling back from the cache, to pull object2 through its key as well.
My guts feels that option 1 is the best practice and the most efficient, but I have second thoughts storing big nested objects under on key.
Aucun commentaire:
Enregistrer un commentaire