See how the cache key is created :
args = md5_constructor(u':'.join([urlquote(resolve_variable(var, context)) for var in self.vary_on])) cache_key = 'template.cache.%s.%s' % (self.fragment_name, args.hexdigest())
The key is a combination of the fragment name ( my_posts ) and the sum of the additional md5 arguments for the cache tag. Since you have no additional arguments, hexdigest is d41d8cd98f00b204e9800998ecf8427e (hash xd5 of the empty string). Therefore, the cache key must be
template.cache.my_posts.d41d8cd98f00b204e9800998ecf8427e
If you need a more general solution, this snippet may help.
Benjamin wohlwend
source share