我正在 Delphi 2007 中创建一个缓存,它将包含记录。
每条记录包含一个字符串,两个日期和一个值。
Type MyRecord = Record
Location : String;
Date1 : TDateTime;
Date2 : TDateTime;
Value : Double;
End;
海滩的最大面积没有保障。
It is highly likely that Location will have several entries for different dates
There are only 13 locations.
高速缓存需要可搜索,并且位于性能关键的位置。
I was thinking of creating a 2 dimensional array for this structure with a sorted string list as an index. So when search I d access the Stringlist to look up the index I need in the array with name value pairs. (Location = Index) Then I d need loop through the items for each location to see if the value is in the cache matching both Date1 and Date2. If the value isn t in the cache I need to go and get it from a database and add it to the cache.
某种类似的东西
Type MyRecord = Record
Date1 : TDateTime;
Date2 : TDateTime;
Value : Double;
End;
...
Cache: Array[1..13] of Array of MyRecord
Locations: TStringList;
由于地点将列于示意图清单。
这个结构适用于缓存吗?