Commit ab18a5e8 authored by mrweiner's avatar mrweiner

Replace all CacheRegisterItem verbiage with Slot

parent b8acff3e
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/cache_register.iml" filepath="$PROJECT_DIR$/.idea/cache_register.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="112bf9a6-8c83-41a8-976a-d66da65cc979" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/src/CacheRegister.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/CacheRegister.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/CacheRegisterInterface.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/CacheRegisterInterface.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/CacheRegisterItem.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Slot.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/CacheRegisterItemInterface.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/SlotInterface.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ComposerSettings">
<execution />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1kRgoMLJcURIxZYv8G5ARzAffWp" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="vue.rearranger.settings.migration" value="true" />
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="112bf9a6-8c83-41a8-976a-d66da65cc979" name="Default Changelist" comment="" />
<created>1605668992930</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1605668992930</updated>
<workItem from="1605668994102" duration="255000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="WindowStateProjectService">
<state x="816" y="815" width="520" height="389" key="#Drupal" timestamp="1605669003197">
<screen x="0" y="0" width="2138" height="1976" />
</state>
<state x="816" y="815" width="520" height="389" key="#Drupal/0.0.2138.1976@0.0.2138.1976" timestamp="1605669003197" />
<state x="125" y="0" width="1915" height="1976" key="#com.intellij.refactoring.rename.AutomaticRenamingDialog" timestamp="1605669123236">
<screen x="0" y="0" width="2138" height="1976" />
</state>
<state x="125" y="0" width="1915" height="1976" key="#com.intellij.refactoring.rename.AutomaticRenamingDialog/0.0.2138.1976@0.0.2138.1976" timestamp="1605669123236" />
<state x="575" y="344" width="988" height="1290" key="find.popup" timestamp="1605669228812">
<screen x="0" y="0" width="2138" height="1976" />
</state>
<state x="575" y="344" width="988" height="1290" key="find.popup/0.0.2138.1976@0.0.2138.1976" timestamp="1605669228812" />
</component>
</project>
\ No newline at end of file
......@@ -19,11 +19,11 @@ class CacheRegister implements CacheRegisterInterface {
protected $registerName;
/**
* Array of items in the register.
* Array of slots in the register.
*
* @var CacheRegisterItem[]
* @var Slot[]
*/
protected $registerItems = [];
protected $registerSlots = [];
/**
* The constructor.
......@@ -32,7 +32,7 @@ class CacheRegister implements CacheRegisterInterface {
* Cache backend.
*
* @param string $cache_register_name
* Prefixes the cache entry IDs of child CacheRegisterItems.
* Prefixes the cache entry IDs of child Slots.
* This should generally be prefixed by the implementor's name,
* so something like my_module.bookshelf
*/
......@@ -45,10 +45,10 @@ class CacheRegister implements CacheRegisterInterface {
/**
* {@inheritDoc}
*/
public function createRegisterItem($item_ids) {
$item = new CacheRegisterItem($this->cache, $this, $item_ids);
$this->registerItems[] = $item;
return $item;
public function createSlot($slot_ids) {
$slot = new Slot($this->cache, $this, $slot_ids);
$this->registerSlots[] = $slot;
return $slot;
}
/**
......@@ -61,16 +61,16 @@ class CacheRegister implements CacheRegisterInterface {
/**
* {@inheritDoc}
*/
public function getItems() {
return $this->registerItems;
public function getSlots() {
return $this->registerSlots;
}
/**
* {@inheritDoc}
*/
public function deleteAll() {
foreach ($this->registerItems as $item) {
$item->deleteCache();
foreach ($this->registerSlots as $slot) {
$slot->deleteCache();
}
}
......@@ -78,8 +78,8 @@ class CacheRegister implements CacheRegisterInterface {
* {@inheritDoc}
*/
public function invalidateAll() {
foreach ($this->registerItems as $item) {
$item->invalidateCache();
foreach ($this->registerSlots as $slot) {
$slot->invalidateCache();
}
}
......
......@@ -11,13 +11,13 @@ interface CacheRegisterFactoryInterface {
*
* @param string $implementor_id
* This should generally be the implementing module's name.
* It will be used as the beginning of all child items'
* It will be used as the beginning of all child slots'
* cache entry IDs.
* @param string|array|null $cache_register_id
* An identifier for the register itself.
* It will be appended to the $implementor_id when
* determining child item's cache entry IDs.
* - If passed an array, items will be imploded.
* determining child slot's cache entry IDs.
* - If passed an array, slots will be imploded.
*
* @return \Drupal\cache_register\CacheRegisterInterface
*/
......
......@@ -7,21 +7,21 @@ namespace Drupal\cache_register;
interface CacheRegisterInterface {
/**
* Creates a new CacheRegisterItem in the register.
* Creates a new Slot in the register.
*
* @note This does note create/populate the associated
* cache entry. You must implement $this->set($data)
* after instantiating the CacheRegisterItem to
* after instantiating the Slot to
* populate its cache entry.
*
* @param array|string $item_ids
* The ID(s) to use for the item's cache identifier.
* @param array|string $slot_ids
* The ID(s) to use for the slot's cache identifier.
* This might be something like a UID if you are
* caching information about a specific user.
*
* @return \Drupal\cache_register\CacheRegisterItemInterface
* @return \Drupal\cache_register\SlotInterface
*/
public function createRegisterItem($item_ids);
public function createSlot($slot_ids);
/**
* @return string
......@@ -30,19 +30,19 @@ interface CacheRegisterInterface {
public function getName();
/**
* @return \Drupal\cache_register\CacheRegisterItemInterface[]
* @return \Drupal\cache_register\SlotInterface[]
*/
public function getItems();
public function getSlots();
/**
* Invalidate (delete) all child item cache entries.
* Invalidate (delete) all child slot cache entries.
*
* @return mixed
*/
public function deleteAll();
/**
* Invalidate (delete) all child item cache entries.
* Invalidate (delete) all child slot cache entries.
*
* @return mixed
*/
......
......@@ -4,7 +4,7 @@ namespace Drupal\cache_register;
use Drupal\Core\Cache\CacheBackendInterface;
class CacheRegisterItem implements CacheRegisterItemInterface {
class Slot implements SlotInterface {
/**
* The cache backend service.
......@@ -34,14 +34,14 @@ class CacheRegisterItem implements CacheRegisterItemInterface {
* Cache backend.
* @param CacheRegisterInterface $parent_cache_register
* The parent CacheRegister object.
* @param array|string $item_ids
* The ID(s) to use for the item's cache identifier.
* @param array|string $slot_ids
* The ID(s) to use for the slot's cache identifier.
*/
public function __construct(CacheBackendInterface $cache, CacheRegisterInterface $parent_cache_register, string $item_ids) {
$this->cache = $cache;
$this->parentCacheRegister = $parent_cache_register;
$this->cacheEntryId = $this->constructCacheEntryId($item_ids);
$this->cacheEntryId = $this->constructCacheEntryId($slot_ids);
}
/**
......@@ -127,18 +127,18 @@ class CacheRegisterItem implements CacheRegisterItemInterface {
}
/**
* Constructs the item's cache ID.
* Constructs the slot's cache ID.
*
* Uses the parent register name and the provided IDs.
*
* @param array|string $item_cache_ids
* @param array|string $slot_cache_ids
* One ID, or a set of IDs, used to identify the cache item.
*
* @return string
* Cache ID String
*/
private function constructCacheEntryId($item_cache_ids) {
$cache_id = is_array($item_cache_ids) ? implode('.', $item_cache_ids) : $item_cache_ids;
private function constructCacheEntryId($slot_cache_ids) {
$cache_id = is_array($slot_cache_ids) ? implode('.', $slot_cache_ids) : $slot_cache_ids;
return "{$this->parentCacheRegister->getName()}:$cache_id";
}
......
......@@ -4,21 +4,21 @@ namespace Drupal\cache_register;
use Drupal\Core\Cache\CacheBackendInterface;
interface CacheRegisterItemInterface {
interface SlotInterface {
/**
* Checks if the item has an entry in the cache.
* Checks if the slot has an entry in the cache.
*
* @return bool
* Whether or not the item with the given ids is cached.
* Whether or not the slot with the given ids is cached.
*/
public function isCached();
/**
* Sets the item's cache entry.
* Sets the slot's cache entry.
*
* @param mixed $data
* The data to be saved to the given cache item.
* The data to be saved to the given cache slot.
*
* @param int $expire
* One of the following values:
......@@ -41,7 +41,7 @@ interface CacheRegisterItemInterface {
public function setCache($data, int $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = []);
/**
* Sets the given tags on the item's cache entry.
* Sets the given tags on the slot's cache entry.
*
* @param array|string $tags
* An array of tags to add to the cache item.
......@@ -52,7 +52,7 @@ interface CacheRegisterItemInterface {
public function setCacheTags($tags);
/**
* Adds the given tags to the item's cache entry.
* Adds the given tags to the slot's cache entry.
*
* @param array|string $tags
* One or multiple tags to append to the item.
......@@ -63,7 +63,7 @@ interface CacheRegisterItemInterface {
public function addCacheTags($tags);
/**
* Gets the items cache entry.
* Gets the slots cache entry.
*
* @return object|false
* The cache item or FALSE on failure.
......@@ -71,17 +71,17 @@ interface CacheRegisterItemInterface {
public function getCache();
/**
* Delete the item's cache entry.
* Delete the slot's cache entry.
*/
public function deleteCache();
/**
* Delete the item's cache entry.
* Delete the slot's cache entry.
*/
public function invalidateCache();
/**
* Get the ID of the item's cache entry.
* Get the ID of the slot's cache entry.
*
* @return string
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment