PINCacheObjectSubscripting.h 933 B

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // PINCacheObjectSubscripting.h
  3. // PINCache
  4. //
  5. // Created by Rocir Marcos Leite Santiago on 4/2/16.
  6. // Copyright © 2016 Pinterest. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. @protocol PINCacheObjectSubscripting <NSObject>
  11. @required
  12. /**
  13. This method enables using literals on the receiving object, such as `id object = cache[@"key"];`.
  14. @param key The key associated with the object.
  15. @result The object for the specified key.
  16. */
  17. - (nullable id)objectForKeyedSubscript:(NSString *)key;
  18. /**
  19. This method enables using literals on the receiving object, such as `cache[@"key"] = object;`.
  20. @param object An object to be assigned for the key. Pass `nil` to remove the existing object for this key.
  21. @param key A key to associate with the object. This string will be copied.
  22. */
  23. - (void)setObject:(nullable id)object forKeyedSubscript:(NSString *)key;
  24. @end
  25. NS_ASSUME_NONNULL_END