-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Cache strategy: Only cache the attributes of AMS #547
Conversation
AS cache_digests when you update code for the serializer, You need not expired cache manually
Pretty keen for caching to come back. Also, recursive relationships (Item has_many: items) breaks/broke caching. Should I create a new issue for this? Seems silly when the caching has been taken out. |
@JulianLeviston It's so bad for recursive relationships. I never discover this case in my product. Can you give an example in real situation? |
@zlx Not sure what you mean by "it" when you say "it's so bad for recursive relationships". However, my application has exactly such a recursive relationship... I have a model called Item that has a parent, which is also an Item. (In other words, it's a tree of objects). This is my real application, and it's a real situation. All I want to do is cache a JSON render. I'm not doing any embedding, just caching primary keys. There are no loops... (ie the root parent item is not referred to in any of the subsequent item children) and yet the library loops infinitely for some reason when asked to cache it. The object trees that I have in my app are probably at most like 10 objects deep in terms of parent/children, and all I want to do is get "all the items", flat, with their referring primary keys (ie their parent_id records). I'd reckon your PR would address this issue, no? |
@JulianLeviston In my understanding, you have situation like below:
for this new cache strategy, I only use cache to replace all the object's attrs, so it will work I think. But in your situation with so deep relations, I think cache global is more efficiently. consider cache the whole object like use jbuilder to cache AMS or use perforated to cache AMS. I want to use this PR to make the cache can work efficiently as far as possible when some object changed, because it's the mostly use case I think. |
@zlx I'm not sure. Thanks tho :) |
I'm not currently interested in adding huge new features to 0.9, sorry! We will certainly bring caching back in 0.10. |
New Cache Strategy: Only cache the attributes of AMS
I think It's better to manage attributes only for AMS.
example:
imagine we have an AMS A, which contain AMS B, which contain AMS C.
Beside, It will detect the AMS class's change and automatic expired the cache.