Commit 7559c146 authored by mrweiner's avatar mrweiner
Browse files

Issue #3243147 by mrweiner: SlotInterface is incomplete

parent 9fbb6bd1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ class Register extends SlotBase implements RegisterInterface {
  /**
   * {@inheritDoc}
   */
  protected function setCache($data, $expire = CacheBackendInterface::CACHE_PERMANENT, $tags = []): void {
  public function setCache($data, $expire = CacheBackendInterface::CACHE_PERMANENT, $tags = []): void {
    $this->doSetCache($data, $expire, $tags);
  }

+2 −21
Original line number Diff line number Diff line
@@ -122,28 +122,9 @@ abstract class SlotBase implements SlotBaseInterface {
  }

  /**
   * Sets the slot's cache entry.
   *
   * @param mixed $data
   *   The data to be saved to the given cache slot.
   * @param int $expire
   *   One of the following values:
   *   - CacheBackendInterface::CACHE_PERMANENT: Indicates that the item should
   *     not be removed unless it is deleted explicitly.
   *   - A Unix timestamp: Indicates that the item will be considered invalid
   *     after this time, i.e. it will not be returned by get() unless
   *     $allow_invalid has been set to TRUE. When the item has expired, it may
   *     be permanently deleted by the garbage collector at any time.
   * @param array $tags
   *   An array of tags to be stored with the cache item. These should normally
   *   identify objects used to build the cache item, which should trigger
   *   cache invalidation when updated. For example if a cached item represents
   *   a node, both the node ID and the author's user ID might be passed in as
   *   tags. For example ['node:123', 'node:456', 'user:789'].
   *
   * @see CacheBackendInterface
   * {@inheritDoc}
   */
  abstract protected function setCache($data, int $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = []): void;
  abstract public function setCache($data, int $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = []): void;

  /**
   * Common inner method for abstracted setCache.
+24 −0
Original line number Diff line number Diff line
@@ -76,4 +76,28 @@ interface SlotBaseInterface {
   */
  public function addCacheTags($tags): void;

  /**
   * Sets the slot's cache entry.
   *
   * @param mixed $data
   *   The data to be saved to the given cache slot.
   * @param int $expire
   *   One of the following values:
   *   - CacheBackendInterface::CACHE_PERMANENT: Indicates that the item should
   *     not be removed unless it is deleted explicitly.
   *   - A Unix timestamp: Indicates that the item will be considered invalid
   *     after this time, i.e. it will not be returned by get() unless
   *     $allow_invalid has been set to TRUE. When the item has expired, it may
   *     be permanently deleted by the garbage collector at any time.
   * @param array $tags
   *   An array of tags to be stored with the cache item. These should normally
   *   identify objects used to build the cache item, which should trigger
   *   cache invalidation when updated. For example if a cached item represents
   *   a node, both the node ID and the author's user ID might be passed in as
   *   tags. For example ['node:123', 'node:456', 'user:789'].
   *
   * @see CacheBackendInterface
   */
  public function setCache($data, int $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = []): void;

}