Interface RestCacheStore


@JsType(isNative=true, name="ng.RestCacheStore", namespace="<global>") public interface RestCacheStore
Async cache store used by CachedRestBackend. The interface is deliberately small so implementations can be backed by IndexedDB, the browser Cache API, local storage, memory, or test fixtures.
  • Method Summary

    Modifier and Type
    Method
    Description
    elemental2.promise.Promise<Void>
    Delete one cached REST response.
    elemental2.promise.Promise<Void>
    Delete cached REST responses whose keys start with the prefix.
    <T> elemental2.promise.Promise<RestResponse<T>>
    get(String key)
    Read a cached REST response by deterministic key.
    <T> elemental2.promise.Promise<Void>
    set(String key, RestResponse<T> response)
    Store a REST response by deterministic key.
  • Method Details

    • delete

      elemental2.promise.Promise<Void> delete(String key)
      Delete one cached REST response.
      Parameters:
      key - Exact cache key to remove.
      Returns:
      Method result.
    • deletePrefix

      elemental2.promise.Promise<Void> deletePrefix(String prefix)
      Delete cached REST responses whose keys start with the prefix. `CachedRestBackend` uses prefixes such as `GET /api/users` to invalidate collection and entity entries after successful writes.
      Parameters:
      prefix - Value supplied for the prefix parameter.
      Returns:
      Method result.
    • get

      <T> elemental2.promise.Promise<RestResponse<T>> get(String key)
      Read a cached REST response by deterministic key.
      Parameters:
      key - Opaque cache key supplied by CachedRestBackend.
      Returns:
      Method result.
    • set

      <T> elemental2.promise.Promise<Void> set(String key, RestResponse<T> response)
      Store a REST response by deterministic key.
      Parameters:
      key - Opaque cache key supplied by CachedRestBackend.
      response - Response to persist.
      Returns:
      Method result.