Closed sriedel closed 14 years ago
I think you are missing the point of index. It is not a per object index; i.e. hey I loaded this object, let's stick it's "index" value in the hash. When you specify an index you say hey I'm interested in all values match x for field y and so cache-money performs that query and populates the cache with the results. It's the only way to guarantee that the cache is correct.
The queries triggered per index do a where over the indexed attributes, causing multiple slow queries in the database if you're trying to have indices for cache money without indexing the same attributes in the database.
Intuitively, a design that fetches the object once for the index updates and updates each index with the values from that fetched object would be a more straight forward procedure.
Alternatively, invalidate all indices for a class on a write, and fetch the data for an index once that particular index is read.