cache.go 686 B

12345678910111213141516171819202122
  1. package api
  2. // CacheNamespace is the type of a cache.
  3. type CacheNamespace string
  4. const (
  5. // UserCache is the cache type of users.
  6. UserCache CacheNamespace = "u"
  7. // MemoCache is the cache type of memos.
  8. MemoCache CacheNamespace = "m"
  9. // ShortcutCache is the cache type of shortcuts.
  10. ShortcutCache CacheNamespace = "s"
  11. // ResourceCache is the cache type of resources.
  12. ResourceCache CacheNamespace = "r"
  13. )
  14. // CacheService is the service for caches.
  15. type CacheService interface {
  16. FindCache(namespace CacheNamespace, id int, entry interface{}) (bool, error)
  17. UpsertCache(namespace CacheNamespace, id int, entry interface{}) error
  18. DeleteCache(namespace CacheNamespace, id int)
  19. }