Kache.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // Kache.h
  3. // KacheDemo
  4. //
  5. // Created by jiajun on 7/25/12.
  6. // Copyright (c) 2012 __MyCompanyName__. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @class KHolder;
  10. @interface Kache : NSObject
  11. @property (strong, nonatomic) NSString *filetoken;
  12. - (id)initWithFiletoken:(NSString *)filetoken;
  13. - (void)newQueueWithName:(NSString *)name size:(NSInteger)size;
  14. - (void)newPoolWithName:(NSString *)name size:(NSInteger)size;
  15. - (void)setValue:(id)value forKey:(NSString *)key expiredAfter:(NSInteger)duration;
  16. - (void)setValue:(id)value inPool:(NSString *)name forKey:(NSString *)key expiredAfter:(NSInteger)duration;
  17. - (void)pushValue:(id)value toQueue:(NSString *)name;
  18. - (void)removeObjectForKey:(NSString *)key;
  19. - (id)popFromQueue:(NSString *)name;
  20. - (id)valueForKey:(NSString *)key;
  21. - (void)save;
  22. - (void)load;
  23. + (Kache *)instance;
  24. + (void)setValue:(id)value forKey:(NSString *)key expiredAfter:(NSInteger)duration;
  25. + (void)setValue:(id)value inDefaultPoolForKey:(NSString *)key expiredAfter:(NSInteger)duration;
  26. + (void)removeObjectForKey:(NSString *)key;
  27. + (void)pushValue:(id)value;
  28. + (id)popValue;
  29. + (id)valueForKey:(NSString *)key;
  30. + (void)setValue:(id)value inPool:(NSString *)name forKey:(NSString *)key expiredAfter:(NSInteger)duration;
  31. + (void)pushValue:(id)value toQueue:(NSString *)name;
  32. + (id)popFromQueue:(NSString *)name;
  33. + (void)newQueueWithName:(NSString *)name size:(NSInteger)size;
  34. + (void)newPoolWithName:(NSString *)name size:(NSInteger)size;
  35. + (void)save;
  36. // 静态load方法,每次启动会被自动调用
  37. + (void)load;
  38. @end