is there a way to disable model caching in development without reloading the config every request?

149 views
Skip to first unread message

oobi

unread,
Dec 3, 2010, 9:12:32 AM12/3/10
to ColdBox Platform
Currently I have my dev context set to coldbox.configAutoReload= true;
since i don't want any model cached while I'm working on it.

Is there a way to accomplish that (disable caching) without reloading
the config/framework on each request? For the most part it's ok, but
slightly annoying when testing i18n since every request reverts back
to the default locale once the config is reloaded. I've created a
seperate environment to faciliate this, but it's a bit awkward having
to flick between the two.

My understanding of cachebox config is fairly limited - can model
caching be disabled for a single environment?

CaptainPalapa

unread,
Dec 3, 2010, 10:51:24 AM12/3/10
to ColdBox Platform
> Is there a way to accomplish that (disable caching) without
reloading
> the config/framework on each request? For the most part it's ok, but

One option is to use the cache="false" option in the cfcomponent
definition. I often do this while working on a single file (or a
couple). Just remember to change them back before you go to
production!

Example:

<cfcomponent displayname="SecurityService" cache="false" hint="I
provide a service layer for permissions management." output="false">

Curt Gratz

unread,
Dec 3, 2010, 4:07:06 PM12/3/10
to col...@googlegroups.com
//Model Integration
models = {
objectCaching = false
};

That should do it. Then just change the variable per environment.

function staging(){
models.objectCaching = true;
}

--
You received this message because you are subscribed to the Google
Groups "ColdBox Platform" group.
To post to this group, send email to col...@googlegroups.com To
unsubscribe from this group, send email to
coldbox-u...@googlegroups.com
For more options, visit this group at
http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org

Andrew Scott

unread,
Dec 3, 2010, 4:14:16 PM12/3/10
to col...@googlegroups.com
Or you could just do this in your coldbox.cfc


//--------------------------------------------------------------------------
----------------------

//--------------------------------------------------------------------------
----------------------
string function detectEnvironment() {
return replace(createObject( 'java', 'java.net.InetAddress'
).getLocalHost().getHostName(),"-","","all" );
}


//--------------------------------------------------------------------------
----------------------
// Configuration settings for the testing / staging server

//--------------------------------------------------------------------------
----------------------
void function Federation() {
coldbox.debugMode = false;
coldbox.handlersIndexAutoReload = false;
coldbox.configAutoReload = false;
coldbox.debugPassword = "";
coldbox.reinitPassword = "";

//coldbox.handlerCaching = true;
//coldbox.eventCaching = true;
}


Regards,
Andrew Scott
http://www.andyscott.id.au/


> -----Original Message-----
> From: col...@googlegroups.com [mailto:col...@googlegroups.com] On
> Behalf Of CaptainPalapa
> Sent: Saturday, 4 December 2010 2:51 AM
> To: ColdBox Platform
> Subject: [coldbox:7066] Re: is there a way to disable model caching in
> development without reloading the config every request?
>

> --
> You received this message because you are subscribed to the Google Groups
> "ColdBox Platform" group.
> To post to this group, send email to col...@googlegroups.com To
> unsubscribe from this group, send email to coldbox-

> unsub...@googlegroups.com

oobi

unread,
Dec 3, 2010, 6:53:13 PM12/3/10
to ColdBox Platform
thanks for pointing me at that setting - I missed the model struct!

Unfortunately it's brought up another issue, though -- this is either
a bug with autowire or some issue with how I've set it up, but I get
stack overflows when I disable model caching as described above
(models.objectCaching=false). I'm using Coldbox's inbuilt DI.

Here's a cleaned up stack trace -- these four entries repeat in
sequence until the stack overflows:

LINE : 293
Template: BeanFactory.cfc
method : getModel
stopRecursion=arguments.stopRecursion

LINE : 869
Template: BeanFactory.cfc
method : getModelDSL
locatedDependency = getModel(argumentCollection=args);

LINE : 773
Template: BeanFactory.cfc
method : getDSLDependency
case "model" : { dependency =
getModelDSL(definition=arguments.definition); break; }

LINE : 682
Template: BeanFactory.cfc
method : autowire
thisDependency =
getDSLDependency(definition=targetDIEntry.dependencies[x]);


I don't really know enough about how this works to determine a cause,
but I've dropped a debug log here in case it helps:

http://pastebin.com/zVShdvFR

From the looks of things it's continuously recreating the same objects
over and over. I had a check for anything that looked like a circular
dependency but couldn't find anything (I assume that would be a
problem?)

With caching ON the thing works beautifully.

Any idea what might be happening?

Reply all
Reply to author
Forward
0 new messages