Nitai @ Razuna wrote:
Hi Alan,

Very impressive. From reading the docs some questions come to mind:

1. Regions
For a multi tenant system one would need to have different regions. I
guess setting them up each with a "region[clientid]" would work, yes?
no not necessarily ... you could build the client into the key. I wouldnt run a different cache for each different client that would be way too much.

When it comes to caching the modern approach is not to remove items, but to simply let them expire. Deleting is such an expensive operation. That is why it is discouraged in memcached. Instead you build a token into the key that changes when you need to flush.

Example key:  clientid + clienttoken + someactualreference

so when you need to expire the content for the client, you simply change/increment the clienttoken, thus invalidating all the keys which effectively empties the cache naturally. It takes a little bit of a mind shift to see this, but trust me, it will actually make your caching management infinitely easier than having to remember to manually flush specific groups.

So in other words, an effective caching management should NEVER have to reach for CacheRemove/CacheRemoveAll. If you find yourself reaching for those functions then rethink.

2. cfquery
I've used cachename and cachedomain for most of my queries. Is that
still supported? Is there a benefit by using the "caching"? I guess
cache domain could be replaced with region then? How can we then clearthe cache for 
certain "regions" only? Would I have to create a regionfor queries, functions, 
etc?
cachename is still supported, but cachedomain is not. It won't break, just won't be used. region is now in the cfquery to let it know which engine to use.

by default, salesforce, cfquery and cfcachecontent all have their own region.

3. functions
Caching a function would simply cache the output of the function or?
Again, on a multi tenant system I guess the region has to be unique
for each tenant or else every client gets the same results?
It caches the return result, NOT the output. If the function produces output through its own CFOUTPUT/WriteOutput then that won't be cached. Only the <cfreturn> result effectively.

Again, the cache key will diff based on the input params it gets. so if different clients produce different results, make sure you pass that client id as one of the parameters. Small hint: the parameter need not be used in the function itself to be considered part of the cache key.


Hope this helps.


--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en

Reply via email to