#import <time.h>
#import "LUGlobal.h"
#import "LUPrivate.h"
#import "LUCache.h"
#import "LUAgent.h"
#import <NetInfo/syslock.h>
@interface CacheAgent : LUAgent
{
struct {
LUArray *all;
} rootInitGroups;
struct {
LUCache *cache;
unsigned int capacity;
time_t ttl;
time_t delta;
unsigned int freq;
BOOL validate;
BOOL enabled;
} cacheStore[NCACHE];
struct {
LUArray *all;
BOOL validate;
BOOL enabled;
} allStore[NCATEGORIES];
syslock *cacheLock;
char *initgroupsUserName;
LUDictionary *stats;
unsigned int lastSweep;
unsigned int sweepTime;
}
+ (int)cacheForKey:(char *)key category:(LUCategory)cat;
- (void)setCapacity:(unsigned int)max forCategory:(LUCategory)cat;
- (unsigned int)capacityForCategory:(LUCategory)cat;
- (void)setTimeToLive:(time_t)timeout forCategory:(LUCategory)cat;
- (time_t)timeToLiveForCategory:(LUCategory)cat;
- (void)setCacheIsValidated:(BOOL)validate forCategory:(LUCategory)cat;
- (BOOL)cacheIsValidatedForCategory:(LUCategory)cat;
- (void)setCacheIsEnabled:(BOOL)enabled forCategory:(LUCategory)cat;
- (BOOL)cacheIsEnabledForCategory:(LUCategory)cat;
- (void)addTimeToLive:(time_t)delta
afterCacheHits:(unsigned int)freq
forCategory:(LUCategory)cat;
- (time_t)cacheTimeToLiveDeltaForCategory:(LUCategory)cat;
- (unsigned int)cacheTimeToLiveFrequencyForCategory:(LUCategory)cat;
- (void)addObject:(LUDictionary *)item;
- (void)removeObject:(LUDictionary *)item;
- (void)addArray:(LUArray *)array;
- (LUArray *)initgroupsForUser:(char *)name;
- (void)setInitgroups:(LUArray *)groups forUser:(char *)name;
- (void)flushCache;
- (void)flushCacheForCategory:(LUCategory)cat;
- (BOOL)containsObject:(id)obj;
- (void)sweepCache;
@end