advertise

Entries in memcached (1)

Tuesday
Feb052013

Ask HighScalability: Memcached and Relations

Hi everybody

I'm wondering what you would do: I develop a webapp using Grails, Memcached and Mysql as persistence. Now, I have following domain classes (simplified):

Product: Can be in one category
Category: Can have nested children, and have multiple products.

I need to access all product objects by id which led me to the idea to store all products in one big Memcached-entry with a key: PRODUCTMAP and as value, all product attributes as array, like: [productId1: [title: 'title'], productId2: [title: 'title']]

If I browse to category 4, I simply get my map categoryMap with value [cateoryId: [productId1, productId2]]
I also can list all products of a certain category by providing that id. 

The bad thing about this is that I always have to put back everything if I modify a single product.

Who can give advice how to realize that?
Any help will be appreciated! 

Thanks,

Best
Sullivan