Answers.Body: <blockquote>
    <p>"Due to the amount of queries to this backend we will probably run out of its auto incremental key space."</p>
  </blockquote>
  
  <p>That would seem to suggest that maybe your template caching strategy should be re-visited?</p>
  
  <p>Are there really going to be 215 million (from a signed int) unique pieces of cached content that need to be saved?</p>
  
  <blockquote>
    <p>Now my question is can I override the twig cache subsystem?</p>
  </blockquote>
  
  <p>Right now, there aren't any hooks or events into the template caching layer, but a few people have asked for it to hook up to external services like memcached, redis, varnish, fastly, etc.  So it's on our list to add some events for plugins to get notified when things like cache expiration occurs for a piece of content.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-10T17:38:03.133Z
Answers.Text: Since I had to output my json (rest) using twig to avoid the ssluggish responses, all combinations of params and different apis will be cached in a mysql record. So the maxint scared me a bit. If it was a bigint I would worry that much :) It would be very nice to have such a hook and/or event in that layer. Originally I didnt want to cache at all on that level and let the middleware layer (NodeJS) take care of the caching, but I need some sort of event from the CMS in order to clear and regenerate the cache.
Answers.UserDisplayName: pythic
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-11T07:26:35.783Z
Answers.Text: BRad, I've read somewhere on a thread here that this feature should be released in 2.2. However I dont think it made it right? Can you tell me when we can expect such a feature. For me its becoming very important issue. Thanks in advance
Answers.UserDisplayName: pythic
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-11T15:37:35.643Z
Answers.Text: Yeah... didn't make it into 2.2. It's on the 2.3 list, but no ETA on that, sorry.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-12T01:50:34.097Z
Answers.Text: Hi Brad, any update on this as of 2016?
Answers.UserDisplayName: Simon East
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-10T17:33:33.090Z
Answers.LastActivityDate: 2014-09-10T17:33:33.090Z
Answers.UserDisplayName: Brad Bell
Body: <p>We're in the process of building a restfull backend in craft. We had sluggish response times due to the amount of queries done by craft on a an entry listing. Each entry had about 3 levels of nesting and a list of 9 entries tool 10-13 seconds to render.</p>
  
  <p>I've worked around this by outputting the json using twig and its cache. Now I've noticed that craft uses mysql to cache its data. Due to the amount of queries to this backend we will probably run out of its auto incremental key space. This platform has over 2 million unique visitors a day. (I've seen it before and it will happen) </p>
  
  <p>Now my question is can I override the twig cache subsystem? For example use Redis so I can proactively notify middleware and/or frontend that caches have been cleared, so these tiers can regenerate the cache while still serving stale cache? And/or is there an event available inside the cache system so I can trigger on that?</p>
  
  <p>Thanks in advance</p>
  
Tags: <templating><cache><performance>
Title: Is there a way to override the template caching system?
ThreadText: # Is there a way to override the template caching system?
  
  (Asked by: username_0 on 2014-09-10)
  
  We're in the process of building a restfull backend in craft. We had sluggish response times due to the amount of queries done by craft on a an entry listing. Each entry had about 3 levels of nesting and a list of 9 entries tool 10-13 seconds to render.
  
  I've worked around this by outputting the json using twig and its cache. Now I've noticed that craft uses mysql to cache its data. Due to the amount of queries to this backend we will probably run out of its auto incremental key space. This platform has over 2 million unique visitors a day. (I've seen it before and it will happen)
  
  Now my question is can I override the twig cache subsystem? For example use Redis so I can proactively notify middleware and/or frontend that caches have been cleared, so these tiers can regenerate the cache while still serving stale cache? And/or is there an event available inside the cache system so I can trigger on that?
  
  Thanks in advance
  
  **Tags:** templating, cache, performance
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-09-10. Score: 5 | Accepted answer
  
  > "Due to the amount of queries to this backend we will probably run out of its auto incremental key space."
  
  That would seem to suggest that maybe your template caching strategy should be re-visited?
  
  Are there really going to be 215 million (from a signed int) unique pieces of cached content that need to be saved?
  
  > Now my question is can I override the twig cache subsystem?
  
  Right now, there aren't any hooks or events into the template caching layer, but a few people have asked for it to hook up to external services like memcached, redis, varnish, fastly, etc. So it's on our list to add some events for plugins to get notified when things like cache expiration occurs for a piece of content.
  
  > **Comments:**
  > **username_0**: Since I had to output my json (rest) using twig to avoid the ssluggish responses, all combinations of params and different apis will be cached in a mysql record. So the maxint scared me a bit. If it was a bigint I would worry that much :) It would be very nice to have such a hook and/or event in that layer. Originally I didnt want to cache at all on that level and let the middleware layer (NodeJS) take care of the caching, but I need some sort of event from the CMS in order to clear and regenerate the cache.  
  > **username_0**: BRad, I've read somewhere on a thread here that this feature should be released in 2.2. However I dont think it made it right? Can you tell me when we can expect such a feature. For me its becoming very important issue. Thanks in advance  
  > **username_1**: Yeah... didn't make it into 2.2. It's on the 2.3 list, but no ETA on that, sorry.  
  > **username_2**: Hi username_1, any update on this as of 2016?  
  
  ---
  
  