|
- Function Set_Cache_Value(Cache_Name,Cache_Val,Reload_Time)
- Dim cacheValue,cacheReload_Time,Reload_TimeValue
- cacheValue = Application("cache_"&Cache_Name)
- cacheReload_Time = Application("cache_"&Cache_Name&"_Val")
- if cacheValue = "" then
- cacheReload_Time = DateAdd("s",Reload_Time,Now)
- end if
- Reload_TimeValue = DateDiff("s", Now, cacheReload_Time)
- if Reload_TimeValue > 0 and cacheValue <> "" then
- Set_Cache_Value = cacheValue
- else
- Application.Lock
- Application("cache_"&Cache_Name) = Cache_Val
- Application("cache_"&Cache_Name&"_Val") = DateAdd("s",Reload_Time,Now)
- Application.UnLock
- end if
- End Function
- call set_Cache_Value("token",token,30*1*60*60*24)
复制代码
适合日常的变量缓存等 |
|