From http://37signals.com/svn/posts/3113-how-key-based-cache-expiration-works
"You deal with dependency structures by tying the model objects together on updates. So if you change a todo that belongs to a todolist that belongs to a project, you update the updated_at timestamp on every part of the chain, which will automatically then update the cache keys based on these objects."
I am learning about key based caching and trying to implement in .Net. This is the one point I am struggling with, updating cache items which are dependant on a recently update cache item.
class Parent
{
public int ID;
public DateTime updated_at;
public Child child;
}
class Child
{
public int ID;
public DateTime updated_at;
public string name;
}
Say I add Child
to the cache. Then create Parent
using that Child
and cached that too. When I update the Child
I want to bust the cache for the Parent
in the same manner that 37Signals has.
The only way I can see is by updating the updated_at
flag on the Parent
at the same time I am on the Child
. I am not sure though and would love some clarification.
Thanks alot!