diff --git a/core/lib/Drupal/Core/Cache/Static/StaticCache.php b/core/lib/Drupal/Core/Cache/Static/StaticCache.php new file mode 100644 index 0000000..cabc8a1 --- /dev/null +++ b/core/lib/Drupal/Core/Cache/Static/StaticCache.php @@ -0,0 +1,63 @@ +data)) { + return FALSE; + } + // Check expire time. + $cache->valid = $cache->expire == Cache::PERMANENT || $cache->expire >= $this->getRequestTime(); + + if (!$allow_invalid && !$prepared->valid) { + return FALSE; + } + + return $cache; + } + + /** + * {@inheritdoc} + */ + public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array()) { + assert('\Drupal\Component\Assertion\Inspector::assertAllStrings($tags)', 'Cache Tags must be strings.'); + $tags = array_unique($tags); + // Sort the cache tags so that they are stored consistently in the database. + sort($tags); + $this->cache[$cid] = (object) array( + 'cid' => $cid, + 'data' => $data, + 'created' => $this->getRequestTime(), + 'expire' => $expire, + 'tags' => $tags, + ); + } + +} diff --git a/core/lib/Drupal/Core/Cache/Static/StaticCacheInterface.php b/core/lib/Drupal/Core/Cache/Static/StaticCacheInterface.php new file mode 100644 index 0000000..275ea13 --- /dev/null +++ b/core/lib/Drupal/Core/Cache/Static/StaticCacheInterface.php @@ -0,0 +1,18 @@ +