I added on a little to Brian's wiki entry with an example that shows
how to check to see if caching is enabled.
http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/wiki/IntroToCaching#AccessingtheCachefromaMach-IIListener

I guess this really brings up the question if 'put' should put the
entry in the cache if it's disabled... or should it just be left up to
the specific implementation?  What should the expected behavior be?

-- Jason

On Dec 18, 9:02 am, Brian Klaas <[email protected]> wrote:
> I added a small block to the wiki page about accessing a cache from a
> listener. I can definitely see how this would be useful.
>
> On Dec 17, 12:28 pm, "Peter J. Farrell" <[email protected]> wrote:
>
> > Yes, I think that is a reasonable (and really the only approach).  You
> > might save yourself some typing and few CPU cycles by stashing a
> > reference to the cache in your configure() method
>
> > <cffunction name="configure">
> >     <cfset variables.myCache =
> > getAppManager().getCacheManager().getCacheStrategyManager().getCacheStrateg 
> > yByName("mycache")
> > />
> > </cffunction>
>
> > Then just reference <cfset variables.myCache.put/get() /> where
> > necessary.  Remember to construct a unique key.
>
> > Probably not a lot of people in Mach-II have done this yet (I've used
> > the caching package for non-Mach-II projects a bit).  If you think have
> > any ideas that might help integration for places like this (listeners,
> > or non-Mach-II applications) that would make working with the caching
> > package easier -- please feel free to bring it up on the list.
>
> > Best,
> > .Peter
>
> > P.s.  There is a page on the wik on using the caching package outside of
> > Mach-II application -- which would apply here.  Feel free to expand:
>
> >https://greatbiztoolsllc.trac.cvsdude.com/mach-ii/wiki/UsingCachingOu...
>
> > It doesn't show using the CacheStrategyManager which was designed to be
> > used independently of Mach-II MVC as well.
>
> > jason.york said the following on 12/17/2009 07:44 AM:
>
> > > I wanted to get your opinion to see if this would be a "recommended"
> > > way to access the Mach-ii cache.  I want to be able to put and get
> > > items from the cache from my listener.  I am able to do so through a
> > > call such as:
> > > getAppManager().getCacheManager().getCacheStrategyManager
> > > ().getCacheStrategyByName("mycache").get(key)
> > > and
> > > getAppManager().getCacheManager().getCacheStrategyManager
> > > ().getCacheStrategyByName("mycache").put(key, data)
>
> > > Is this something you would discourage?
>
> > > Thanks,
> > >   -- Jason
>
> > --
>
> > The Harmonious Programmer
> > <http://feeds.feedburner.com/%7Er/TheHarmoniousProgrammer/%7E6/1>
>
> > *Peter J. Farrell*
> > Email: [email protected] | p...@maestropublishing
> > Blog: The Harmonious Programmer <http://blog.maestropublishing.com>
> > Twitter/Identi.ca: @maestrofjp

-- 
You received this message because you are subscribed to Mach-II for CFML list.
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/mach-ii-for-coldfusion?hl=en
SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/
Wiki / Documentation / Tickets: 
http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/

Reply via email to