Ah, cool - that wasn't obvious to me.  Thanks, will give it a go!  

Has anyone else implemented a more sophisticated cache, like memcached, or 
redis or other that uses the cache tags in eventhandlers? 


Brian


On Thursday, April 10, 2014 8:01:23 AM UTC-7, Dan Wilson - 
[email protected] wrote:
>
> OK. so if you aren't overriding the configuration in the base (internal) 
> ModelGlue ColdSpring.xml, this is the one that is used:
>
> <bean id="modelGlue.cacheAdapter" 
> class="ModelGlue.gesture.externaladapters.contentcaching.SimpleTimedCache">
>     <constructor-arg 
> name="sweepInterval"><value>10</value></constructor-arg>
> </bean>
>
>
>
> So just use beans.modelGlue.cacheAdapter in your controllers, or inject it 
> into your model as you please.
>
>
> DW
>
>   Brian G <javascript:>
>  Wednesday, April 09, 2014 11:38 PM
> No, I just added the following to my eventhandlers.xml file:
>
> <event-handler name="foo" cache="true" cacheTimeout="300" 
> cacheKeyValues="slug">
>         
>
>
>
> On Monday, April 7, 2014 5:58:44 PM UTC-7, Dan Wilson - 
> [email protected]<javascript:>wrote:
> -- 
> -- 
> Model-Glue Sites:
> Home Page: http://www.model-glue.com
> Documentation: http://docs.model-glue.com
> Bug Tracker: http://bugs.model-glue.com
> Blog: http://www.model-glue.com/blog
>  
> You received this message because you are subscribed to the Google
> Groups "model-glue" group.
> To post to this group, send email to [email protected]<javascript:>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> For more options, visit this group at
> http://groups.google.com/group/model-glue?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "model-glue" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>   Dan Wilson <javascript:>
>  Monday, April 07, 2014 8:58 PM
>  How did you create the SimpleTimedCache? Through ColdSpring?
>
> If so, it would be available in the beans scope (in controllers) and 
> wherever you inject it via ColdSpring into your model.
>
> DW
>
>   Brian G <javascript:>
>  Monday, April 07, 2014 8:57 PM
>
> Fair enough.  How do I get a reference from MG to the SimpleTimedCache so 
> I can test purging?  I understand it's designed to be simple but it might 
> suit my purposes for now.
>
>
> Brian
>
>
> On Wednesday, April 2, 2014 6:16:46 PM UTC-7, Dan Wilson - 
> [email protected] <javascript:> wrote:
> -- 
> -- 
> Model-Glue Sites:
> Home Page: http://www.model-glue.com
> Documentation: http://docs.model-glue.com
> Bug Tracker: http://bugs.model-glue.com
> Blog: http://www.model-glue.com/blog
>  
> You received this message because you are subscribed to the Google
> Groups "model-glue" group.
> To post to this group, send email to [email protected]<javascript:>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> For more options, visit this group at
> http://groups.google.com/group/model-glue?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "model-glue" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>   Dan Wilson <javascript:>
>  Wednesday, April 02, 2014 9:16 PM
>  If you want to expire an element from the cache, I believe you are going 
> to have to pass in the key for that element. Else, how would it know to do 
> this?
>
> The SimpleTimedCache.cfc in the MG distribution is really meant to be 
> ultra simple and provide a working reference implementation so you can plug 
> in your own cache elements.
>
> However, one would beg the question, if you are wanting to cache content, 
> wouldn't you be better off handling this with Varnish or Apache Traffic 
> server? They'll scale way better than a CF based cache for sure.
>
>
> DW
>
>   Brian G <javascript:>
>  Wednesday, April 02, 2014 5:29 PM
>
> I've just turned on eventhandler caching and I'm curious if there is an 
> API to programmatically invalidate an entry?  My handler looks like:
>
> <event-handler name="slug" cache="true" cacheTimeout="300" 
> cacheKeyValues="id">
>
> I'd like to be able to kick out /index.cfm/event/slug/id/12345 whenever 
> slug 12345 is updated.  Possible?  I do see that the SimpleTimedCache.cfc 
> has a purge() method that takes a key but it feels brittle to access it 
> directly and compose the cache key.
>
> Secondarily, I'm thinking about externalizing this cache to use redis or 
> memcached so it can survive between model-glue restarts.  Looks like I just 
> need the same interface and then override it in my modelglue.xml with 
> something like:
>
> <bean id="modelGlue.cacheAdapter" class="my.memcached.CacheAdapter">
>     <constructor-arg 
> name="sweepInterval"><value>10</value></constructor-arg>
> </bean>
>
> Key to my use case is being able to bust the cache when the underlying 
> data changes.  It's infrequent, but needs to update quickly when it does so 
> general timed expiration is not the best fit for this scenario.
>
>
>
>
> Brian
>
>
>
> -- 
> -- 
> Model-Glue Sites:
> Home Page: http://www.model-glue.com
> Documentation: http://docs.model-glue.com
> Bug Tracker: http://bugs.model-glue.com
> Blog: http://www.model-glue.com/blog
>  
> You received this message because you are subscribed to the Google
> Groups "model-glue" group.
> To post to this group, send email to [email protected]<javascript:>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> For more options, visit this group at
> http://groups.google.com/group/model-glue?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "model-glue" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>  
>  

-- 
-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"model-glue" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to