asp自带的内存缓存 application
来源:asp之家 发布时间:2011-03-09 11:18:00
函数getcache,会自动建立需要的缓存。
代码如下:
Function getcache(funsname,isreset,isarr,timeinfo)
‘funsname — 需要缓存的内容,这里要输入一个function名
‘isreset –是否更新[值:0(根据时间或判断缓存为空时自动更新)、1(主动更新)]
‘ isarr —- 所缓存的内容是否为一个数据[0为字符串,1为数组]
‘ timeinfo —- 缓存更新时间,单位为秒,当值为0时,则只在缓存为空时,才更新
dim domain = “cnzhaopin.com.cn”
Dim temp_getconfig
Dim re_getcache : re_getcache = False
Dim temp_isarray_type : temp_isarray_type = False
Dim Appfunsname : Appfunsname = Replace(Replace(Replace(funsname,”(”,”"),”)”,”"),”,”,”.”)
If isarr = 1 Then temp_isarray_type = True
If isreset = 1 Then re_getcache = True
If isreset = 2 Then
execute(”temp_getconfig=”&funsname)
getcache = temp_getconfig
Exit Function
End If
If Application(domain&”_”&Appfunsname&”_time”) = “” And timeinfo<>0 Then re_getcache = True
If Not re_getcache Then
If temp_isarray_type Then
If Not IsArray(Application(domain&”_”&Appfunsname)) Then re_getcache = True
Else
If Application(domain&”_”&Appfunsname) = “” Then re_getcache = True
End If
End If
If Not re_getcache And timeinfo<>0 Then
If Int(DateDiff(”s”,Application(domain&”_”&Appfunsname&”_time”),now()))>timeinfo Then re_getcache = True
End If
If re_getcache Then
execute(”temp_getconfig=”&funsname)
Application.Lock
Application(domain&”_”&Appfunsname) = temp_getconfig
Application(domain&”_”&Appfunsname&”_time”) = Now()
Application.UnLock
Else
temp_getconfig=Application(domain&”_”&Appfunsname)
End If
getcache = temp_getconfig
End Function
使用时,代码如下:
Function output3
output3=”"
set newrs=conn.execute(”select TOP 60 companyname,comid,vipdata,ishot from company where isok=1 and vipqx>60 and vipqx<300 and vip=1 and comid in (select comid from jobs where zt<>1) order by newid()”)
do while not newrs.eof
output3=output3 & “……….”
newrs.movenext
loop
newrs.close
set newrs=nothing
End function
response.write getcache(”output3″,0,0,3600)
猜你喜欢
- Flask子域名一般用于数量比较少的子域名,一个模块对应一个子域名。先看下面一个例子:modules.py:from flask impor
- 前言最近遇到一个统计查询需求,要求一次性查询多个统计信息,其中两个查询信息不在一个表中,也没有业务关联,表中也没有做连接处理。不考虑产品设计
- 由于实际需要,简要写了个小脚本,并打包生成exe,供无网络环境下使用脚本1:显示当前时间与时间戳,以及10分钟后的时间与时间戳# -*- c
- 目录简介创建线程构造器方式继承方式守护线程线程本地数据定时器简介Python 通过 _thread 和 threading 模块提供了对多线
- 一、使用SQL Server全文搜索配置要使用SQL Server的全文搜索服务,需要进行如下配置。1、开启全文搜索服务:2、开启数据库的全
- 本文实例讲述了python安装cx_Oracle模块常见问题与解决方法。分享给大家供大家参考,具体如下:安装或使用cx_Oracle时,需要
- 编者按,网站中让人惊喜的往往是那一点细节,只要用心留意你将发现那些美好的用户体验就在身边。新蛋网想自主控制链接在原窗口还是新窗口中打开?看看
- Python:type、object、classPython: 一切为对象>>> a = 1>>> ty
- 摘要:本文介绍了字符与编码的发展过程,相关概念的正确理解。举例说明了一些实际应用中,编码的实现方法。然后,本文讲述了通常对字符与编码的几种误
- 话说这能难倒我吗?赶赶单单~来 ,开搞!一、准备工作用到的软件准备一哈Python 3.8Pycharm 2021.2知识点Python基础
- 关闭正在运行的 MySQL :[root@www.woai.it ~]# service mysql stop运行[root@www.woa
- tell()方法返回的文件内的文件读/写指针的当前位置。语法以下是tell()方法的语法:fileObject.tell()参数
- 在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致
- 更新多个对象例如说我们现在想要将Apress Publisher的名称由原来的”Apress”更改为”Apress Publishing”。
- 官网: https://matplotlib.org一、版本# 01 matplotlib安装情况 import matplotlib ma
- 故障转移群集是Windows Server中的一个功能,自从在Windows NT 4.0 Enterprise Edition中首次引入群
- 要求:分别以james,julie,mikey,sarah四个学生的名字建立文本文件,分别存储各自的成绩,时间格式都精确为分秒,时间越短成绩
- 通常的做法就是var jsonData = eval(xmlHttp.responseText)。这看起来似乎一切都是正确的,但当你运行代码
- 1、泛型是什么Go1.18增加了对泛型的支持,泛型是一种独立于使用的特定类型编写代码的方式。现在可以编写函数和类型适用于一组类型集合的任何一
- 基础知识介绍以SQL Server的数据库管理工具SSMS(SQL Server Management Studio)为平台进行操作。SQL