AVIMCache.h 666 B

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // AVIMCache.h
  3. // TCShow
  4. //
  5. // Created by AlexiChen on 16/4/14.
  6. // Copyright © 2016年 AlexiChen. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. // 单种消息的缓存
  10. // 固定capacity容量,不会自动增大
  11. @interface AVIMCache : NSObject
  12. {
  13. @protected
  14. NSUInteger _capacity; // cache的容量
  15. NSMutableArray *_cahceQueue; // 缓存队列
  16. }
  17. - (instancetype)initWith:(NSUInteger)capacity;
  18. - (NSUInteger)count;
  19. // 当超过capacity会把lastobject移除,并insert obj到0位置
  20. - (void)enCache:(id)obj;
  21. - (id)deCache;
  22. - (void)clear;
  23. @end
  24. // 会自动增长
  25. @interface AVIMMutableCache : AVIMCache
  26. @end