Roland - I'm writing this for a generic lib (Transfer fo be exact), so it could be instantiated in the application scope anywhere, it could be a singleton in ColdSpring, it could be instance data to another Factory CFC somewhere etc etc. So writing a scheduled task unfortunatley is out of the question (I wish it wasn't!).
The case came out of a having a business need to be able to granularly control how objects were cached in the system. So I'm having to build controls for that. (I.e. I got told if we were going to use Transfer, we would have to have this functionality) The expired slots idea is a good one, and I will probably end up looking into that as well. I'm going to have to do some synchronous cleanup as well, as I can't get Java objects to talk to CF instances of CFCs, but I'm trying to minimise that. I would also like to be able to implement some smart caching - i.e. if you have set a max number of objects to 10, and you have 12, the cache should keep the most accessed objects around, rather than just removing 2 at random. This could be slightly expensive, depending on how you want to do it, so it would be nice to do it in it's own Thread. But thanks for your thoughts, this is an interesting conversation. Mark On 5/9/06, Roland Collins <[EMAIL PROTECTED]> wrote:
What scope wouldn't you be able to access with a scheduled task? A scheduled task should be able to access any scope in the application. You could also consider reusing expired slots instead of full-on garbage collection. In other words - when allocating a new object, just search through your cache and allocate the new object in the first expired slot that you find, or create a new one if necessary. It creates kind of a "lazy" cache that way - you may have expired objects in there, but if there's no side-effect to having them, then it doesn't really matter. That alleviates the threading issue altogether. And IMO, if you can avoid having to do it asynchronously, it'll save you a lot of pain down the road. Roland
-- E: [EMAIL PROTECTED] W: www.compoundtheory.com ICQ: 3094740 ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
