Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Module Caching does not seem to be working since 4.9.0 UpgradeModule Caching does not seem to be working since 4.9.0 Upgrade
Previous
 
Next
New Post
12/2/2008 11:38 AM
 

As a general comment,  the Purge Cache scheduled task does not clear all the cached items (at least in 4.9).

In the File Caching Provider (in 4.9), what the task does do is remove the file stubs, which are used to invalidate the cache in a Web Farm scenario.  If the Web Farm setting is set to false there are no file stubs and the cached objects have no dependency on the file system, so purging the cache does nothing.

I know that shaun made some changes in 4.9 with regard to the File Caching provider and Web Farms so I will check this out.


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
12/2/2008 1:19 PM
 

As mentioned above the Purge Cache method is only used to clear the file stubs that are used as Cache Dependencies for items where the cache has expired in memory.  This allows the other servers in a web farm to be synchronized.  The expectation though from the schedule name might be that the cache is cleared.  This is NOT the case - it is just purging orphaned stub files where the associated cache has expired in memory.

However, in 4.9 the coding in the File Based caching provider was refactored considerably so all the logic (for insertion) could be centralised in one of the overloads.

   85         Public Overloads Overrides Sub Insert(ByVal CacheKey As String, ByVal objObject As Object, ByVal objDependency As CacheDependency, ByVal AbsoluteExpiration As Date, ByVal SlidingExpiration As System.TimeSpan, ByVal Priority As CacheItemPriority, ByVal OnRemoveCallback As CacheItemRemovedCallback, ByVal PersistAppRestart As Boolean)

   86             ' initialize cache dependency

   87             Dim d As Caching.CacheDependency = objDependency

   88 

   89             ' if web farm is enabled in config file

   90             If WebFarmEnabled Then

   91                 ' get hashed file name

   92                 Dim f(0) As String

   93                 f(0) = GetFileName(CacheKey)

   94                 ' create a cache file for item

   95                 CreateCacheFile(f(0), CacheKey)

   96                 ' create a cache dependency on the cache file

   97                 d = New Caching.CacheDependency(f, Nothing, objDependency)

   98             End If

   99 

  100             ' insert the item into memory using the appropriate overload

  101             If d Is Nothing Then

  102                 objCache.Insert(CacheKey, objObject)

  103             ElseIf AbsoluteExpiration = DateTime.MinValue Then

  104                 objCache.Insert(CacheKey, objObject, d)

  105             ElseIf Priority = CacheItemPriority.Default Then

  106                 objCache.Insert(CacheKey, objObject, d, AbsoluteExpiration, SlidingExpiration)

  107             Else

  108                 objCache.Insert(CacheKey, objObject, d, AbsoluteExpiration, SlidingExpiration, Priority, OnRemoveCallback)

  109             End If

  110         End Sub


Now the problem is in Lines 101-108.  If there is no dependency (either a passed in dependency, OR a file stub dependency added because we are in a Web Farm then d id Nothing, so the line 102 is executed and the object is inserted into the cache regardless of the Absolute or Sliding expirations.

So it seems to me that cached objects will be inserted into the web cache with no expiry.

 


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
12/2/2008 5:53 PM
 

Charles Nurse wrote

As mentioned above the Purge Cache method is only used to clear the file stubs that are used as Cache Dependencies for items where the cache has expired in memory.  This allows the other servers in a web farm to be synchronized.  The expectation though from the schedule name might be that the cache is cleared.  This is NOT the case - it is just purging orphaned stub files where the associated cache has expired in memory.

Thanks for your reply Charles - does this mean that we can disable the PurgeCache Task if we are not using a webfarm and memory module caching?

I have updated Gemini with the answers:

1)  I have not changed this (although see Host Settings below) -
    <caching defaultProvider="FileBasedCachingProvider">
        <add name="FileBasedCachingProvider" type="DotNetNuke.Services.Cache.FileBasedCachingProvider.FBCachingProvider, DotNetNuke.Caching.FileBasedCachingProvider" providerPath="~\Providers\CachingProviders\FileBasedCachingProvider\" />
        <add name="BroadcastPollingCachingProvider" type="DotNetNuke.Services.Cache.BroadcastPollingCachingProvider.BPCachingProvider, DotNetNuke.Caching.BroadcastPollingCachingProvider" providerPath="~\Providers\CachingProviders\BroadcastPollingCachingProvider\" />

2.1) false
2.2) false
3) This is a module setting – default = 120 seconds

Host Settings – Enable WebFarm = false.
Module Caching Method = Memory
Authenticated Cachebility = Public
Scheduler Mode = Timer (it was on Request until I noticed the Scheduler stopped working in 4.9)

 

 


Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
12/2/2008 8:12 PM
 

Yes the Purge Cache task is only really needed in web Farm scenarios.


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
3/1/2009 3:36 PM
 

Charles Nurse wrote

As mentioned above the Purge Cache method is only used to clear the file stubs that are used as Cache Dependencies for items where the cache has expired in memory.  This allows the other servers in a web farm to be synchronized.  The expectation though from the schedule name might be that the cache is cleared.  This is NOT the case - it is just purging orphaned stub files where the associated cache has expired in memory.

However, in 4.9 the coding in the File Based caching provider was refactored considerably so all the logic (for insertion) could be centralised in one of the overloads.

   85         Public Overloads Overrides Sub Insert(ByVal CacheKey As String, ByVal objObject As Object, ByVal objDependency As CacheDependency, ByVal AbsoluteExpiration As Date, ByVal SlidingExpiration As System.TimeSpan, ByVal Priority As CacheItemPriority, ByVal OnRemoveCallback As CacheItemRemovedCallback, ByVal PersistAppRestart As Boolean)

   86             ' initialize cache dependency

   87             Dim d As Caching.CacheDependency = objDependency

   88 

   89             ' if web farm is enabled in config file

   90             If WebFarmEnabled Then

   91                 ' get hashed file name

   92                 Dim f(0) As String

   93                 f(0) = GetFileName(CacheKey)

   94                 ' create a cache file for item

   95                 CreateCacheFile(f(0), CacheKey)

   96                 ' create a cache dependency on the cache file

   97                 d = New Caching.CacheDependency(f, Nothing, objDependency)

   98             End If

   99 

  100             ' insert the item into memory using the appropriate overload

  101             If d Is Nothing Then

  102                 objCache.Insert(CacheKey, objObject)

  103             ElseIf AbsoluteExpiration = DateTime.MinValue Then

  104                 objCache.Insert(CacheKey, objObject, d)

  105             ElseIf Priority = CacheItemPriority.Default Then

  106                 objCache.Insert(CacheKey, objObject, d, AbsoluteExpiration, SlidingExpiration)

  107             Else

  108                 objCache.Insert(CacheKey, objObject, d, AbsoluteExpiration, SlidingExpiration, Priority, OnRemoveCallback)

  109             End If

  110         End Sub


Now the problem is in Lines 101-108.  If there is no dependency (either a passed in dependency, OR a file stub dependency added because we are in a Web Farm then d id Nothing, so the line 102 is executed and the object is inserted into the cache regardless of the Absolute or Sliding expirations.

 

So it seems to me that cached objects will be inserted into the web cache with no expiry.

 

Charles, 

Do you know if this has been resolved?  Since th eonly time a dependency can occur is when in a webfarm, from looking at this code, it is a major issue.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Module Caching does not seem to be working since 4.9.0 UpgradeModule Caching does not seem to be working since 4.9.0 Upgrade


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out