Imports System
Imports System.IO
Imports System.Web
Imports System.Reflection
Imports System.Threading
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Framework.Providers
Imports DotNetNuke.Common
Imports DotNetNuke.Services.Exceptions
Imports System.Web.Caching
Imports System.Xml.Serialization
Namespace DotNetNuke.Services.Cache.micsCachingProvider
Public Class micsCachingProvider
Inherits CachingProvider
Private Const ProviderType As String = "caching"
Private _providerConfiguration As ProviderConfiguration = ProviderConfiguration.GetProviderConfiguration(ProviderType)
Private Shared _objCache As Hashtable
Private Shared ReadOnly Property objCache() As Hashtable
Get
'create singleton of the cache object
If _objCache Is Nothing Then
_objCache = New Hashtable
End If
Return _objCache
End Get
End Property
#Region "Abstract Method Implementation"
Public Overrides Function Add(ByVal Key As String, ByVal Value As Object, ByVal Dependencies As CacheDependency, ByVal AbsoluteExpiration As DateTime, ByVal SlidingExpiration As TimeSpan, ByVal Priority As CacheItemPriority, ByVal OnRemoveCallback As CacheItemRemovedCallback) As Object
If Not objCache.ContainsKey(Key) Then
objCache(Key) = Value
End If
Return (objCache(Key))
End Function
Public Overrides Function GetEnumerator() As IDictionaryEnumerator
Return objCache.GetEnumerator
End Function
Public Overrides Function GetItem(ByVal CacheKey As String) As Object
Return objCache(CacheKey)
End Function
Public Overrides Function GetPersistentCacheItem(ByVal CacheKey As String, ByVal objType As Type) As Object
Return objCache(CacheKey)
End Function
Public Overloads Overrides Sub Insert(ByVal CacheKey As String, ByVal objObject As Object, ByVal PersistAppRestart As Boolean)
objCache(CacheKey) = objObject
End Sub
Public Overloads Overrides Sub Insert(ByVal CacheKey As String, ByVal objObject As Object, ByVal objDependency As CacheDependency, ByVal PersistAppRestart As Boolean)
objCache(CacheKey) = objObject
End Sub
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 PersistAppRestart As Boolean)
objCache(CacheKey) = objObject
End Sub
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)
objCache(CacheKey) = objObject
End Sub
Public Overrides Sub Remove(ByVal CacheKey As String)
If Not objCache(CacheKey) Is Nothing Then
objCache.Remove(CacheKey)
End If
End Sub
Public Overrides Sub RemovePersistentCacheItem(ByVal CacheKey As String)
If Not objCache(CacheKey) Is Nothing Then
objCache.Remove(CacheKey)
End If
End Sub
Public Overrides Function PurgeCache() As String
objCache.Clear()
Return String.Format("Purged of cache synchronization files.")
End Function
Private Function PurgeCacheFiles(ByVal strFiles() As String) As Integer
objCache.Clear()
Return 0
End Function
#End Region
#Region "Private Methods"
#End Region
End Class
End Namespace
build this project. and change the web.config like this :
<caching defaultProvider="micsCachingProvider">
<providers>
<clear/>
<add name="FileBasedCachingProvider" type="DotNetNuke.Services.Cache.FileBasedCachingProvider.FBCachingProvider, DotNetNuke.Caching.FileBasedCachingProvider" providerPath="~\Providers\CachingProviders\FileBasedCachingProvider\"/>
<add name="micsCachingProvider" type="DotNetNuke.Services.Cache.micsCachingProvider.micsCachingProvider, DotNetNuke.Caching.micsCachingProvider" providerPath="~\Providers\CachingProviders\micsCachingProvider\"/>
<add name="BroadcastPollingCachingProvider" type="DotNetNuke.Services.Cache.BroadcastPollingCachingProvider.BPCachingProvider, DotNetNuke.Caching.BroadcastPollingCachingProvider" providerPath="~\Providers\CachingProviders\BroadcastPollingCachingProvider\"/>
</providers>
</caching>
now it work correct.but this is not a good class, it not implement CacheDependency, AbsoluteExpiration , SlidingExpiration , CacheItemPriority, CacheItemRemovedCallback. i hope the core team can implement their own cache .