Would a subroutine help you accomplish what you need?
http://trac.mach-ii.com/machii/wiki/Subroutines

You can still perform the caching within the XML, but call it
anywhere.  The downside is that you still would not be able to easily
access that data directly from a listener.

-- Jason


On Oct 14, 8:08 am, jbuda <[email protected]> wrote:
> I added this line into the listener to see if i have the caching setup
> correctly...
>
> <cfset
> getAppManager().getCacheManager().getCacheStrategyManager().getCacheStrategyByName("navigationCache22").put('navigation',getService().resultNavigation())
>  /
>
>
>
> This works fine, as i am adding the data to the cache from the
> listener. However, i would prefer NOT to do this, but insert it into
> the cache from the XML
>
> On Oct 14, 2:00 pm, jbuda <[email protected]> wrote:
>
> > Hi jason
>
> > the events are not a problem to get working without the cache. I
> > thought i could cache the resultset from the listener and then use
> > that result wherever i need.
>
> > The problem is that i need to use the struct in various places and a
> > number of views. That would mean i would need to cache all the views
> > and within the cache block to access the result set?
>
> > Is there no way i can just cache the result, and then in the view
> > output the contents of the cache. Therefore i can use this within all
> > the views that require the result.
>
> > Thanks
>
> > On Oct 14, 1:55 pm, "jason.york" <[email protected]> wrote:
>
> > > In your view, you can simply just do this:
>
> > > #event.getArg('navigation')#
> > > In your listener call here:
> > > <notify listener="SiteMapListener" method="fullNavigation"
> > > returnArg="navigation" />
>
> > > You're supplying a returnArg.  You'll need to have a <view-page>
> > > within the cache block to get anything useful in the cache.   Really
> > > though I think you should just get your events working the way you
> > > want without cache, and then add the <cache> blocks as the last step.
> > > You don't need to do anything specific with the cache in your view.
>
> > > -- Jason
>
> > > On Oct 14, 6:01 am, jbuda <[email protected]> wrote:
>
> > > > HI Peter
>
> > > > Here are the code snippets that i have.
>
> > > > In the properties section of Mach-ii.xml
>
> > > >                 <property name="Caching" 
> > > > type="MachII.caching.CachingProperty">
> > > >                         <parameters>
> > > >                                 <parameter name="cachingEnabled" 
> > > > value="true" />
> > > >                                 <parameter name="defaultCacheName" 
> > > > value="navigation" />
> > > >                                 <parameter name="navigation">
> > > >                                         <struct>
> > > >                                                 <key name="type"
> > > > value="MachII.caching.strategies.TimeSpanCache" />
> > > >                                                 <key name="scope" 
> > > > value="application" />
> > > >                                                 <key name="timespan" 
> > > > value="0,0,10,0" />
> > > >                                         </struct>
> > > >                                 </parameter>
> > > >                         </parameters>
> > > >                 </property>
>
> > > > Then i have this in a subroutine
>
> > > >                         <cache aliases="full-navigation" 
> > > > strategyName="full_navigation"
> > > > id="navigation">
> > > >                                 <notify listener="SiteMapListener" 
> > > > method="fullNavigation"
> > > > returnArg="navigation" />
> > > >                         </cache>
>
> > > > Then in my view i have
>
> > > > <cfdump
> > > > var="#getAppManager().getCacheManager().getCacheStrategyManager().getCacheS
> > > >  trategyByName("full_navigation").get("navigation")#">
>
> > > > I have also dumped the application scope, but the cache is empty.
> > > > Can you see what i have done wrong? Do i need to do anythiong else?
>
> > > > Thanks
>
> > > > On Oct 13, 11:11 pm, "Peter J. Farrell" <[email protected]> wrote:
>
> > > > > jbuda said the following on 10/13/2010 04:59 PM:> Hi Peter
>
> > > > > > I'm not sure how I put the value into the cache. Is it not the same 
> > > > > > as
> > > > > > I would put a view? Or, wrapping the cache tag in the XML around the
> > > > > > <view-page>?
>
> > > > > > Read the link you sent, so do I have to code the putting if the 
> > > > > > value
> > > > > > into the cache within the listener, and not use the XML?
>
> > > > > If you wrap a cache tag around commands in the XML, the cache tag
> > > > > automatically creates the key.  If you are going it from within a
> > > > > listener is a different place, you have to know the key.
>
> > > > > I guess I'm not understand the question.  Can you explain what you are
> > > > > trying to do?
>
> > > > > .pjf
>
>

-- 
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

***New URLs as of April 29th, 2010***
SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Reply via email to