This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » development » Feature requests » Use events to clear some selective parts of the cache
Use events to clear some selective parts of the cache [message #78011] Fri, 08 May 2009 18:03
El Riiico  is currently offline El Riiico
Messages: 40
Registered: February 2007
Location: Paris

I might not be alone to find that's it's an headache to clear some selective cache in symfony when :

  • If you have a backend. And hum, it's an exception when you don't need one on your project, no ?
  • If your database can be modified by several ways. For instance, a blog post that can be published by a web form, a mail send or your batch that import an external feed.

When do you need to clear some part of your cache ?

Answer: when the related record in the project model has been modified.

Ok, how could we improve the selective clear cache in an intuitive way ?

By using the cache.yml of my symfony dreams :

  with_layout: false
  lifetime:    86400
    - post.modification
    - post.deletion

Here is the idea:

We just have to configure our BlogPost model so it triggers the "post.modification" and "post.deletion" events and that's all.
Thanks to the cache.yml configuration, symfony clears the corresponding cache parts automatically.

Do you like the concept ? Do you think that something is missing ?
Previous Topic:Integrate PHP Quick Profiler
Next Topic:"host" key added to routing.yml?
Goto Forum:

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software