Hy everybody CacheBox question, i need to put one ...
# box-products
n
Hy everybody CacheBox question, i need to put one view in cache, the CacheBox create an object in the region, when users see the view, they “use” the same object or there are many objects with the same view? PS. Sorry for the english, i’m not very good at writing
b
@Nicole Liliana Sorry, I'm not quite following
When you say "view", do you mean the "ID" of the cache entry-- or are you specifically using the ColdBox feature called "View caching"?
Perhaps you can show us some code.
n
@bdw429s View caching
b
Ok, so for each view name, there is one object in cache. So
Copy code
renderView( 'main/index' )
creates a single object in cache with the cached rendered output for that view
And all places in the code that render the same view will use the same cached output
Note, this won't work if you have dynamic content inside your views, such as data specific to a user
This is for static content
Does that help answer the question? @Nicole Liliana
n
@bdw429s ok one object for one view but this object is the same for any users that open the page?
b
Yes
View caching is very simple 🙂
Event caching allows you to have different versions of the cache based on the request collection
n
i’m so sorry for the stupid questions by i’m new in this framework
b
So • site.com/main/index?productID=5site.com/main/index?productID=17 has two cached items for the event
main.index
But view caching is only based on the name of the view
n
then if i don’t change the name of the object in different point of code it would be the same
b
Not sure I follow that
Is that a question or a statement?
n
sorry is a question
b
Can you restate it please? perhaps show some code?
n
#renderView(cache=“true”)# this is the code in my layout.cfm when i’m rendering the view
so coldbox create an object with the name cbox_view-main/index for example
the object with the name “cbox_view-main/index” is the same if me and you open the same page?
b
Correct
The view is cached
Everyone sees the same content on it
n
ty so much
Copy code
may I ask what do you think about caching objects?
i mean create an object by coldfusion and put it in cache
b
Define "object"
Like a CFC instance? A query? An array? A string? something else?
n
CFC instance
b
What sort of cache are you using? in memory? Couchbase? Redis? file system?
n
the same of view caching
b
That doesn't answer the question
What type of cache does your view caching use?
It can be set to anything
n
you mean the scope of cache?
b
That would be the
template
cache
No, where is the cache stored
Cachebox allows you to configure whatever you want
For example, the ortus sites use an external Couchbase bucket for our template cache
What have you configured?
n
Hi
my defaultCache in my coldbox application have this parameter --> objectStore: “ConcurrentStore” my template cache in my coldbox application have this parameter -->objectStore: “ConcurrentSoftReferenceStore”
b
@Nicole Liliana Those are both in-memory caches, so storing a CFC instance would not be an issue
There are often problem with serializing CFCs if you want to store them in an external cache, but memory caches are fine
n