无为清净楼资源网 Design By www.qnjia.com
复制代码 代码如下:
<%
Rem =================================================================
Rem = 类:CacheCls
Rem = 说明:缓存的应用
Rem = Revision:1.01 Beta
Rem = 作者:熊氏英雄(cexo255)
Rem = Date:2005/05/6 18:38:10
Rem = QQ:30133499
Rem = MySite:Http://www.Relaxlife.net
Rem = 下载:Http://www.Relaxlife.net/cexo/Cache_pro.rar
Rem = QQ群:4341998
Rem = 适用:对一些常用到,而又不常改变的数据放入缓存中,调用速度要比每次都要从数据库中读要快N陪
Rem =================================================================
CacheName = "RL"
Class CacheCls
Private LocalCacheName, Cache_Data
Public Property Let Name(ByVal vNewValue)
LocalCacheName = LCase(vNewValue)
Cache_Data=Application(CacheName & "_" & LocalCacheName)
End Property
Public Property Let Value(ByVal vNewValue)
Dim N,i,NewValueArr
If LocalCacheName<>"" Then
N = CountInStr(vNewValue,"|")
NewValueArr = Split(vNewValue,"|",-1,1)
ReDim Cache_Data(N)
For i = 0 to N
Cache_Data(i) = NewValueArr(i)
Next
Application.Lock
Application(CacheName & "_" & LocalCacheName) = Cache_Data
Application.unLock
Else
Response.Write "设置缓存出错,或缓存名不能为空,请重新更新缓存"
Response.End()
End If
End Property
Public Property Get Value()
If LocalCacheName<>"" Then
If IsArray(Cache_Data) Then
Value=Cache_Data
End If
Else
Response.Write "设置缓存出错,或缓存名不能为空,请重新更新缓存"
Response.End()
End If
End Property
'取指定缓存中的值
Public Function GetCacheValue(MyCaheName)
GetCacheValue = Application(CacheName & "_" & MyCaheName)
End Function
'取所有缓存名
Public Function GetallCacheName()
Dim Cacheobj
For Each Cacheobj in Application.Contents
GetallCacheName = GetallCacheName & Cacheobj & ","
Next
GetallCacheName = Left(GetallCacheName,Len(GetallCacheName)-1)
GetallCacheName = Replace(GetallCacheName,CacheName & "_","")
End Function
'释放缓存
Public Sub DelCahe(MyCaheName)
Application.Lock
Application.Contents.Remove(CacheName & "_" & MyCaheName)
Application.unLock
End Sub
'释放所有缓存
Public Sub RemoveAllCache()
Dim Cachelist,i
Cachelist=Split(GetallCacheName(),",")
If UBound(Cachelist)>0 Then
For i=0 to UBound(Cachelist)
DelCahe Cachelist(i)
Next
End If
End Sub
'统计字符Char在Str中出现的次数
Private Function CountInStr(Str,Char)
CountInStr = 0
Dim i, CharLen
CharLen = Len(Char)
For i = 1 to Len(Str)
If Mid(Str, i, CharLen) = Char Then CountInStr = CountInStr + 1
Next
End Function
End Class
Dim CachePro
Set CachePro = New CacheCls
'设置缓存“cexo255”和它的值:"cexo2551|cexo2552|cexo2553|cexo2554|cexo2555"
CachePro.Name = "cexo255"
CachePro.Value = "cexo2551|cexo2552|cexo2553|cexo2554|cexo2555"
'取当前缓存中的值
'CacheArr = CachePro.Value
CachePro.Name = "wxf"
CachePro.Value = "wxf"
CachePro.Name = "dw"
CachePro.Value = "dw"
'释放缓存cexo255
'CachePro.DelCahe("cexo255")
'释放所有缓存
'CachePro.RemoveAllCache
'取cexo255缓存中的值
CacheArr = CachePro.GetCacheValue("cexo255")
If isArray(CacheArr) Then
For i = 0 to UBound(CacheArr)
Response.Write CacheArr(i) & "<br>"
Next
Else
Response.Write "缓存被释放!!!"
End if
Set CachePro = Nothing
%>
<%
Rem =================================================================
Rem = 类:CacheCls
Rem = 说明:缓存的应用
Rem = Revision:1.01 Beta
Rem = 作者:熊氏英雄(cexo255)
Rem = Date:2005/05/6 18:38:10
Rem = QQ:30133499
Rem = MySite:Http://www.Relaxlife.net
Rem = 下载:Http://www.Relaxlife.net/cexo/Cache_pro.rar
Rem = QQ群:4341998
Rem = 适用:对一些常用到,而又不常改变的数据放入缓存中,调用速度要比每次都要从数据库中读要快N陪
Rem =================================================================
CacheName = "RL"
Class CacheCls
Private LocalCacheName, Cache_Data
Public Property Let Name(ByVal vNewValue)
LocalCacheName = LCase(vNewValue)
Cache_Data=Application(CacheName & "_" & LocalCacheName)
End Property
Public Property Let Value(ByVal vNewValue)
Dim N,i,NewValueArr
If LocalCacheName<>"" Then
N = CountInStr(vNewValue,"|")
NewValueArr = Split(vNewValue,"|",-1,1)
ReDim Cache_Data(N)
For i = 0 to N
Cache_Data(i) = NewValueArr(i)
Next
Application.Lock
Application(CacheName & "_" & LocalCacheName) = Cache_Data
Application.unLock
Else
Response.Write "设置缓存出错,或缓存名不能为空,请重新更新缓存"
Response.End()
End If
End Property
Public Property Get Value()
If LocalCacheName<>"" Then
If IsArray(Cache_Data) Then
Value=Cache_Data
End If
Else
Response.Write "设置缓存出错,或缓存名不能为空,请重新更新缓存"
Response.End()
End If
End Property
'取指定缓存中的值
Public Function GetCacheValue(MyCaheName)
GetCacheValue = Application(CacheName & "_" & MyCaheName)
End Function
'取所有缓存名
Public Function GetallCacheName()
Dim Cacheobj
For Each Cacheobj in Application.Contents
GetallCacheName = GetallCacheName & Cacheobj & ","
Next
GetallCacheName = Left(GetallCacheName,Len(GetallCacheName)-1)
GetallCacheName = Replace(GetallCacheName,CacheName & "_","")
End Function
'释放缓存
Public Sub DelCahe(MyCaheName)
Application.Lock
Application.Contents.Remove(CacheName & "_" & MyCaheName)
Application.unLock
End Sub
'释放所有缓存
Public Sub RemoveAllCache()
Dim Cachelist,i
Cachelist=Split(GetallCacheName(),",")
If UBound(Cachelist)>0 Then
For i=0 to UBound(Cachelist)
DelCahe Cachelist(i)
Next
End If
End Sub
'统计字符Char在Str中出现的次数
Private Function CountInStr(Str,Char)
CountInStr = 0
Dim i, CharLen
CharLen = Len(Char)
For i = 1 to Len(Str)
If Mid(Str, i, CharLen) = Char Then CountInStr = CountInStr + 1
Next
End Function
End Class
Dim CachePro
Set CachePro = New CacheCls
'设置缓存“cexo255”和它的值:"cexo2551|cexo2552|cexo2553|cexo2554|cexo2555"
CachePro.Name = "cexo255"
CachePro.Value = "cexo2551|cexo2552|cexo2553|cexo2554|cexo2555"
'取当前缓存中的值
'CacheArr = CachePro.Value
CachePro.Name = "wxf"
CachePro.Value = "wxf"
CachePro.Name = "dw"
CachePro.Value = "dw"
'释放缓存cexo255
'CachePro.DelCahe("cexo255")
'释放所有缓存
'CachePro.RemoveAllCache
'取cexo255缓存中的值
CacheArr = CachePro.GetCacheValue("cexo255")
If isArray(CacheArr) Then
For i = 0 to UBound(CacheArr)
Response.Write CacheArr(i) & "<br>"
Next
Else
Response.Write "缓存被释放!!!"
End if
Set CachePro = Nothing
%>
标签:
CacheCls缓存的应用
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年11月13日
2024年11月13日
- 王心凌《Begin》超值珍藏版CD+VCD[低速原抓WAV+CUE][1G]
- 群星.2024-乘风踏浪电视原声带【讯通诒合】【FLAC分轨】
- 施文彬.2008-苦酒恋歌【华特】【WAV+CUE】
- 江美琪.2012-房间【星娱音乐】【WAV+CUE】
- 【原神手游】5.2前瞻直播开启时间
- 幽灯蕈怎么获得?幽灯蕈素材获取攻略分享
- 【原神】V5.2攻略 | 5.2下半双龙材料速刷!
- 《质量效应》系列销量突破2500万份 续作5正在开发中
- 魔兽30周年直播预告:加入魔兽30周年的庆典
- 魔兽世界蓝贴:史诗安苏雷克女王调整
- 群星《涂鸦低音炮1》黑胶精选 [WAV+CUE][1G]
- 容祖儿《小小》香港首版 [WAV+CUE][1.1G]
- 费玉清《天之大》SONY台湾版 [WAV+CUE][1G]
- 英雄联盟双城之战第二季主题曲谁唱的 双城之战2主题曲演唱歌手介绍
- 逆水寒2024双11活动有什么 2024双11特惠活动开始时间