我的代码量很大
'¸ù¾ÝID»ñÈ¡Êý¾Ý,""´ú±íÉÐ믧´æ´ËÊý¾Ý»òÒѾÎÞЧ
Public Function getData(id As String) As String
If capacity = 0 Then
getData = ""
Exit Function
End If
Dim obj As CacheObj
Dim data As String
data = ""
On Error GoTo err0
obj = objs.Item(id)
'´Ë¶ÔÏóÓÀ²»³¬Ê±
If obj.GetLimitTime() = 0 Then
data = obj.getData()
'´Ë¶ÔÏóÔÚÉú´æÆÚÄÚ
ElseIf DateDiff("n", obj.getFirst(), Now) < obj.GetLimitTime() Then
data = obj.getData()
Else
'¶ÔÏ󳬳öÉú´æÆÚ
data = ""
removeData (id)
End If
If data <> "" Then
obj.setAccess (Now)
End If
getData = data
Exit Function
err0: 'ÉÐ믧´æ´Ë¶ÔÏó
getData = ""
End Function
'»º´æ¶ÔÏó
Public Sub setData(id As String, data As String, first As Date, limit As Integer)
If capacity = 0 Then
Exit Sub
End If