Great feedback, thank you! I've updated the code to reflect your suggestions, I'm particularly glad you had a name suggestion (the name was troubling me!).
I handled the anonymous cache issue slightly differently to your suggestion, if the cacheName parameter is an empty string (or not provided), named caches are not used. It would be great to see this in the 1.9 repo, and feel free to make any changes. I'm not 100% that it is compatible with CF9, but according to the CF9 docs it should be ok. I also haven't tested it on OpenBD. All the best Joe On Oct 21, 11:08 pm, "Peter J. Farrell" <[email protected]> wrote: > Joe Roberts said the following on 10/21/2010 11:14 AM:> Hi Peter. > > > Many thanks for your response. I got stuck in, and have a working > > cache strategy using cachePut() and cacheGet(). I'm running it on > > Railo, but I think it would only require minor changes to the public > > methods, to get it working on an engine that implements cachePut() and > > cacheGet(). > > > Here's the code:http://github.com/zefer/MachIICacheStrategies > > > I would be happy to write a wiki entry, once I have experimented > > further. > > Looking good Joe! A few comments: > > * I'd call the stategy TimespanNativeCfmlStrategy.cfc > * I think the only compatibility issue is the getCacheName() which is > not supported on CF9 -- that don't offer the ability to have many named > caches. Probably as simple as adding a boolean flag in the configure > method called allowNamedCache = true/false and wrapping if/else > statements using the flag to support both named caches for Railo and > unnamed caching on CF9 > * You don't have to create a CacheStats CFC -- the init() in the > AbstractCacheStrategy CFC will create the correct one for you (either > CFML arithmetic or the Java atomic integers). > * Your PROPERTIES section can just look like this as everything else > is setup by the CFC that we extend: > > <!--- > PROPERTIES > ---> > <cfset variables.instance.strategyTypeName = "Native CachePut/CacheGet" /> > > Congrats! You build a caching strategy and I bet it wasn't too hard to > figure out. I'm keen on pulling this into the 1.9 repo if I your > permission (I'd definitely see to it that you get named in the > contributors list). I'm going to ping the BER dev list to get a > consensus there. > > .pjf -- 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 ***New URLs as of April 29th, 2010*** SVN: http://svn.mach-ii.com/machii/ Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
