RE: [coldbox:3353] Interceptors and caching...

Where exactly are you seeing the number "2"? If you are looking at the
pie chart on the cache monitor, that is NOT number of hits, that is
number of interceptors stored in the cache.

If you are looking in the list of cached objects in the "hits" column
next to the name of your interceptor (ex:
interceptor-coldbox.system.interceptors.ses) then that should be the
actual hit count for that specific cache item.

Funny thing is, even though the interceptors are stored in the OCM
cache, they aren't retrieved from there. A quick look through the
interceptor service shows that the actual instance of your interceptor
object is stored in a linkedHashMap in the inerceptorState Bean for the
corresponding state it listens to which is stored in a struct with the
rest of the interceptor states in the interceptorService which stored
directly in the main ColdBox controller object.

So in short, yes a reference to your interceptors are "cached" in _both_
the ColdBox framework as well as the OCM cache even though it appears
the version in the OCM cache is never touched again.

Perhaps Luis can clear up why he does that. :slight_smile:

~Brad

Hi guys,

Here is the deal with interceptors. Interceptors are created by the
framework, then its reference is stored in the appropriate observation
state pool objects. Finally the same reference is added to the cache
for easy lookup via the getInterceptor() method. Therefore, if you do
not try to retrieve interceptors via the getInterceptor() method, then
the hits will never go up, as internally, these references are already
represented in the observation pool objects.

Consider the cache and easy way to get to the interceptor if you need
to talk to it. In 3.0.0 we added the ability to do a soft search
(cache) or a hard search (going to all object pools to find a match).