Guest User

Untitled

a guest
Jun 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. import java.util.List;
  2.  
  3. public interface DiskCache<T> {
  4.  
  5. /**
  6. * Sets the value to {@code value}.
  7. */
  8. public void set(String key, T value);
  9.  
  10. /**
  11. * Returns a value by {@code key}, or null if it doesn't
  12. * exist is not currently readable. If a value is returned, it is moved to
  13. * the head of the LRU queue.
  14. */
  15. public T get(String key);
  16.  
  17. /**
  18. * Drops the entry for {@code key} if it exists and can be removed. Entries
  19. * actively being edited cannot be removed.
  20. *
  21. * @return true if an entry was removed.
  22. */
  23. public boolean remove(String key);
  24.  
  25. /**
  26. * Returns all values from cache directory if all files are same type
  27. *
  28. * @return
  29. */
  30. public List<T> getAll();
  31.  
  32. /**
  33. * Deletes all file from cache directory
  34. */
  35. public void clear();
  36.  
  37. /**
  38. * Returns true if there is file by {@code key} in cache folder
  39. *
  40. * @param key
  41. * @return
  42. */
  43. public boolean exists(String key);
  44.  
  45. /**
  46. * Closes this cache. Stored values will remain on the filesystem.
  47. */
  48. public void close();
  49.  
  50. }
Add Comment
Please, Sign In to add comment