Archived
1
This repository has been archived on 2022-08-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mathpad/MathPad/MPArrayCache.h
2014-09-06 01:54:15 +02:00

35 lines
966 B
Objective-C

//
// MPArrayCache.h
// MathPad
//
// Created by Kim Wittenburg on 31.08.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
// A wrapper around NSCache to support index-based caches. Indexes are
// automatically adjusted to represent array-like behaviours.
@interface MPArrayCache : NSObject {
@private
NSCache *_cache;
}
- (id)init; /* designated initializer */
- (void)cacheObject:(id)object
forIndex:(NSUInteger)index;
- (id)cachedObjectForIndex:(NSUInteger)index;
- (void)clearCacheAtIndex:(NSUInteger)index
replacementLength:(NSUInteger)replacementLength;
- (void)clearCacheInRange:(NSRange)range
replacementLength:(NSUInteger)replacementLength;
- (void)replaceCachedObjectAtIndex:(NSUInteger)index
withObjects:(NSArray *)objects;
- (void)replaceCachedObjectsInRange:(NSRange)range
withObjects:(NSArray *)objects;
@end