The Meta-Environment API
00001 #ifndef __CACHE_UTILS__ 00002 #define __CACHE_UTILS__ 00003 00004 #include <term-store.idef> 00005 00006 /* sort of generic caching processes */ 00007 process ClearCacheHandler(TableName: str, 00008 Namespace: term, 00009 AttributeName: term, 00010 OldValue: term, 00011 NewValue: term) is 00012 let 00013 AttributeEvent: attribute-changed-event, 00014 ModuleId: module-id, 00015 Value: term 00016 in 00017 MM-Subscribe-Attribute-Changed(<module-id>,Namespace,AttributeName,OldValue,NewValue) 00018 . 00019 ( 00020 rec-note(mm-attribute-changed(AttributeEvent?)) 00021 . ACE-GetModuleId(AttributeEvent, ModuleId?) 00022 . snd-msg(ts-remove-value(TableName, ModuleId)) 00023 ) 00024 * delta 00025 endlet 00026 00027 process InitCache(TableName: str) is 00028 snd-msg(ts-add-table(TableName, "term")) 00029 00030 process GetCachedValue(TableName: str, Key: term, Value: term?) is 00031 snd-msg(ts-get-term-value(TableName, Key)) 00032 . 00033 ( 00034 rec-msg(ts-value(TableName, Key, Value?)) 00035 + 00036 rec-msg(ts-no-value(TableName, Key)) 00037 . Value := UNDEFINED 00038 ) 00039 00040 process PutCachedValue(TableName: str, Key: term, Value: term) is 00041 snd-msg(ts-put-term-value(TableName, Key, Value)) 00042 00043 process ClearCachedValue(TableName: str, Key: term) is 00044 snd-msg(ts-remove-value(TableName, Key)) 00045 00046 #endif /* __CACHE_UTILS__ */