Caching json setting files

Hi,

I have some components that need to read setting files that are in json
format upon init. The files are fairly static, so I was thinking that I
should cache them to minimize file reads. What would be the recommended
way to cache them?

Thank you.

ML

Cache them in the application scope?

How you go about that is upto you, it could simply be by accessing the
application scope directly from your component although this probably isn’t
the “right” way to do it.

If you are using a framework with dependency injection (coldbox, fw1 etc)
then you should wrap access to your configs using a caching loader class,
then inject that into any components that require the config.

If you’re using Coldspring (we still do!) then you can create a factory
bean to load configs and define beans for the actual configs themselves,
something like



If the components that need to read the config are not singletons, then you
should create a factory for them that injects the config when it creates a
new instance, then replace any new cfc() or createobject() calls with calls
to factory.new() etc…

HTH,
ChrisOn Sat, 10 Oct 2015 12:20 ML <@ML1> wrote:

Hi,

I have some components that need to read setting files that are in json
format upon init. The files are fairly static, so I was thinking that I
should cache them to minimize file reads. What would be the recommended
way to cache them?

Thank you.

ML


See Lucee at CFCamp Oct 22 & 23 2015 @ Munich Airport, Germany - Get your
ticket NOW - http://www.cfcamp.org/

You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/55a9c1b4-0e51-40f9-9823-753bd8950655%40googlegroups.com
https://groups.google.com/d/msgid/lucee/55a9c1b4-0e51-40f9-9823-753bd8950655%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.