CacheBox Annotations
If you would like to use CacheBox for persistence for you objects you will need to mark your CFC with the following annotation(s)
    cachebox="[provider]" - The default provider is called 'default', so this annotation can be empty or a named cache provider
    cache - Cache into the default provider, shorthand annotation, no value needed
This annotation has two sub annotations that you can also leverage for granular control of your CacheBox integration:
    cacheTimeout - The timeout in minutes (optional)
    cacheLastAccessTimeout - The last access or idle timeout in minutes (optional)
1
// cache into the default provider
2
component cache{}
3
// cache into the default provider
4
component cachebox{}
5
6
// cache into the ehcache provider
7
component cachebox="ehcache"{}
8
9
// cache into the ehcache provider with settings
10
component cachebox="ehcache" cacheTimeout="20"{}
11
12
// cache with settings
13
component cache cacheTimeout="60" cacheLastAccessTimeout="10"{}
Copied!
Caution When storing objects in volatile scopes like cache, session, request, etc. You must be careful of not injecting them directly into singletons or other volatile objects as you could have memory leaks via a side effect called Scope Widening Injection. We recommend combining them via WireBox Providers to avoid this side effect.
Copy link