Invalidating cache php e datingbook com
These placeholders can be dynamically determined based on the entity that is being changed.
Here is a quick example: Let’s say you have an entity called Blog Post: The get Posts For User method does exactly what it says, pass in the a user ID and all the posts for that user are returned. Now what happens when a Blog Post is inserted by this user? The cached results for this query need to be invalidated.
As above make sure the method paths are correct, there is no error checking in place for this yet.
Don’t forget to set a result cache driver in config.yml, there are several available including memcache, memcached, redis and apc.
It then looks at all of the entities that are going to be changed (inserted, updated or deleted) and clears the result cache based on a configuration array.
In your configuration each cache ID has a ‘change’ key that can be insert, update, delete or any.The configuration array contains keys with the entity classes and the cache keys that should be invalidated when there is a match.Each cache key contains a cache string and a number of placeholders.The cache ID config can contain multiple entities and each entity can contain multiple cache keys to clear.
Right now there is no way to share the same cache key among multiple entities. Note that you cannot use the short twig syntax yet.
In case the underlying cache storage does not support this feature, it will be simulated.