Developer forum

Forum » Development » Page Cache and Custom module

Page Cache and Custom module


Reply

Hi,

 

I have a question about dw page cache in relation to a custom module.

I noticed that if i enable dw page Cache:'Entire page' that the output of a custom module is loaded from cache. As soon as a querystring parameter is posted the module is never loaded from cache.

 

If i look at asp.net output cache feature you can control for which parameters output cache varied.

 

Is it posible for a custom module to use the dw cache feature? And how can i use it?

 

Or is the only way to implement my own custom caching at module level?

 

Regards,

- Remi

 


Replies

 
Reply

You can use something like this to interact with the cache class:

 

Dynamicweb.Cache Cache = new Dynamicweb.Cache();
Cache.SetCacheFile("MyModuleName", ParagraphID);
//To set cache
Cache.SaveCache("HTML output from paragraph", "2008/09/04");
//To load cache
Cache.GetCache()

 
Nicolai Høeg Pedersen
Reply
r.muller wrote:

Hi,

 

I have a question about dw page cache in relation to a custom module.

I noticed that if i enable dw page Cache:'Entire page' that the output of a custom module is loaded from cache. As soon as a querystring parameter is posted the module is never loaded from cache.

 

If i look at asp.net output cache feature you can control for which parameters output cache varied.

 

Is it posible for a custom module to use the dw cache feature? And how can i use it?

 

Or is the only way to implement my own custom caching at module level?

 

Regards,

- Remi

 

Hi Remi
 

 

Dynamicweb "standard" caching knows which modules that are cahceable. Custom modules are not cacheable by definition. So to enable caching in your modules you should use System.web.caching.

 

Enabling full page caching can give som unwanted behaviour since it is rather "dumb" if the content is just a little dynamic. So never use it if you have extranet users logged in.


 

 
Reply

Is that to say that it wouldn't be possible to use dw caching, or is it just easier to use .Net caching. My point was making something like .SetCacheFile("ModuleSystemName_[querystring parameters]") and then look for this, when the module is invoked. If a match is found, the module returns the cached content. Or is that just making things too complicated?

 
Nicolai Høeg Pedersen
Reply

No problem using Dynamicweb caching. It uses the filesystem to save the generated output where .NET caching uses the memory.

 

The reason I suggest .NET caching is the capability to vary the caching by parameter as Remi asked for.

 
Reply

Good point:)

 
Reply

Thank you for your the extra feedback.

I tried the dw cache which stores the data om disk which works but i have to implement a cache file per parameter name and value.

I'll try .net cache with the varybyparams feature.

 

Regards,

- Remi

 

You must be logged in to post in the forum