tag:blogger.com,1999:blog-5424132702988443424.post5162743242849784936..comments2023-10-26T07:43:05.437-05:00Comments on Bears. Beets. Battlestar Galactica.: AOP, Caching, and memcachedTony Nelsonhttp://www.blogger.com/profile/17222036859676784775noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5424132702988443424.post-88267554695102432662010-02-01T12:47:53.491-06:002010-02-01T12:47:53.491-06:00It's worked out pretty well so far. I'm on...It's worked out pretty well so far. I'm only doing request/session level caching right now, since I don't feel comfortable enough with memcached to put it into a production environment.<br /><br />Here's what I got hung up on, in case you try to write something similar:<br /><br />1) ColdSpring's AOP doesn't handle dynamic default values for arguments. Since the proxy is created by introspecting the component's metadata, any dynamic default values, such as "#now()#", will be converted to "[Runtime Expression]" or something like that. This isn't really a ColdSpring problem, but a limitation of ColdFusion's getMetaData(). So if you're trying to intercept a method that uses dynamic defaults, you might want to use switch your logic to check if the key exists in the arguments scope instead.<br /><br />2) The data gets cached using a unique key generated from the method's arguments, ensuring that if the same method is called again with the same set of arguments, the result will be fetched from the cache. Trying to generate the key for complex data types can be tricky, although you could maybe serialize your objects to JSON and try that out. However, I'm not sure if ColdFusion serializes JSON the same way (case, order) every time or not though.<br /><br />3) Cache invalidation. http://martinfowler.com/bliki/TwoHardThings.html<br /><br />If I were to re-write what I have, I might try to combine the AOP functionality from ColdSpring with the caching functionality from LogBox. I haven't used LogBox yet, but from what I've read it's worth looking into.Tony Nelsonhttps://www.blogger.com/profile/17222036859676784775noreply@blogger.comtag:blogger.com,1999:blog-5424132702988443424.post-91224952180679125532010-02-01T12:24:31.677-06:002010-02-01T12:24:31.677-06:00Hey Tony. This is actually really interesting; I t...Hey Tony. This is actually really interesting; I think I'm running into the same issue with a Flex/AS3 app I'm writing; my caching code is starting to proliferate, much to my annoyance, and I find it really annoying.<br />Did this AO direction you were heading off to ever work out? It certainly seems intriguing...Rich Ghost Wolfnoreply@blogger.com