Skip to content

Commit

Permalink
Merge pull request #3 from TinkoffCreditSystems/feature/tags
Browse files Browse the repository at this point in the history
(feat) dynamic tags support
  • Loading branch information
drwatsno authored May 28, 2019
2 parents e990f7f + 38d446f commit ca6042d
Show file tree
Hide file tree
Showing 44 changed files with 1,617 additions and 1,051 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

#### [1.1.0]
- support for dynamic tags in Manager's default storage via "getTags" option.
- updated jest
- security updates

#### [1.0.1]
- update package.json information
- version bump
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ function getSomething() {

`get` will check the tags and compare their versions with the current date, runs an executor if necessary and returns result.
Options for `get`:
- expiresIn ?: number; - The number of milliseconds after which key values are considered expired
- tags ?: string [] - Tags - keys for which checks the validity of a particular record. If the tag value in the cache + invalidation time is <the current time, then the tag will be considered invalid and the record will need to be obtained using the executor
- expiresIn?: number; - The number of milliseconds after which key values are considered expired
- tags?: string[] - Tags - keys for which checks the validity of a particular record. If the tag value in the cache + invalidation time is <the current time, then the tag will be considered invalid and the record will need to be obtained using the executor
- getTags?: (executorResult) => string[] function which extracts tags from executor result. These tags will be merged with tags given in option below.

The next method, "touch", serves to invalidate tags. Calling this method with one of the tags will make all records in the cache with this tag invalid.
It can be used both to invalidate a single record (for example, by creating a unique id) or a group of records.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/assets/js/search.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions docs/api/classes/basemanager.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in managers/base.ts:25</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/managers/base.ts#L25">managers/base.ts:25</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -156,7 +156,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> locked<wbr>Key<wbr>
<div class="tsd-signature tsd-kind-icon">locked<wbr>Key<wbr>Retrieve<wbr>Strategies<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><a href="../interfaces/lockedkeyretrievestrategy.html" class="tsd-signature-type">LockedKeyRetrieveStrategy</a><span class="tsd-signature-symbol">&gt;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in managers/base.ts:47</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/managers/base.ts#L47">managers/base.ts:47</a></li>
</ul>
</aside>
</section>
Expand All @@ -166,7 +166,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> logger</h3>
<div class="tsd-signature tsd-kind-icon">logger<span class="tsd-signature-symbol">:</span> <a href="../interfaces/logger.html" class="tsd-signature-type">Logger</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in managers/base.ts:49</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/managers/base.ts#L49">managers/base.ts:49</a></li>
</ul>
</aside>
</section>
Expand All @@ -176,7 +176,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> storage</h3>
<div class="tsd-signature tsd-kind-icon">storage<span class="tsd-signature-symbol">:</span> <a href="../interfaces/storage.html" class="tsd-signature-type">Storage</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in managers/base.ts:45</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/managers/base.ts#L45">managers/base.ts:45</a></li>
</ul>
</aside>
</section>
Expand All @@ -194,7 +194,7 @@ <h3><span class="tsd-flag ts-flagAbstract">Abstract</span> get</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/manager.html">Manager</a>.<a href="../interfaces/manager.html#get">get</a></p>
<ul>
<li>Defined in managers/base.ts:51</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/managers/base.ts#L51">managers/base.ts:51</a></li>
</ul>
</aside>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
Expand Down Expand Up @@ -229,7 +229,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> get<wbr>Locked<wbr>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in managers/base.ts:92</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/managers/base.ts#L92">managers/base.ts:92</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -252,7 +252,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> is<wbr>Tags<wbr>Out
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in managers/base.ts:56</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/managers/base.ts#L56">managers/base.ts:56</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -279,7 +279,7 @@ <h3><span class="tsd-flag ts-flagAbstract">Abstract</span> set</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/manager.html">Manager</a>.<a href="../interfaces/manager.html#set">set</a></p>
<ul>
<li>Defined in managers/base.ts:54</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/managers/base.ts#L54">managers/base.ts:54</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down Expand Up @@ -308,7 +308,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> update<wbr>Cache<wb
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in managers/base.ts:63</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/managers/base.ts#L63">managers/base.ts:63</a></li>
</ul>
</aside>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
Expand Down Expand Up @@ -446,4 +446,4 @@ <h2>Legend</h2>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
</body>
</html>
</html>
44 changes: 22 additions & 22 deletions docs/api/classes/basestorage.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:42</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L42">storages/base.ts:42</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -167,7 +167,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> adapter</h3>
<div class="tsd-signature tsd-kind-icon">adapter<span class="tsd-signature-symbol">:</span> <a href="../interfaces/storageadapter.html" class="tsd-signature-type">StorageAdapter</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:75</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L75">storages/base.ts:75</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -183,7 +183,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> commands<wbr>Queue</h3>
<div class="tsd-signature tsd-kind-icon">commands<wbr>Queue<span class="tsd-signature-symbol">:</span> <a href="../interfaces/command.html" class="tsd-signature-type">Command</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> =&nbsp;[]</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:58</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L58">storages/base.ts:58</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -198,7 +198,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> hash<wbr>Keys</h3>
<div class="tsd-signature tsd-kind-icon">hash<wbr>Keys<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:69</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L69">storages/base.ts:69</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -214,7 +214,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> prefix</h3>
<div class="tsd-signature tsd-kind-icon">prefix<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:63</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L63">storages/base.ts:63</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -229,7 +229,7 @@ <h3>storage</h3>
<div class="tsd-signature tsd-kind-icon">storage<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in storages/__mocks__/base.ts:5</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/__mocks__/base.ts#L5">storages/__mocks__/base.ts:5</a></li>
</ul>
</aside>
</section>
Expand All @@ -246,7 +246,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> cached<wbr>Command</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:215</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L221">storages/base.ts:221</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -278,7 +278,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> create<wbr>Key</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:180</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L186">storages/base.ts:186</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -308,7 +308,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> create<wbr>Tag<wbr>Key<
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:186</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L192">storages/base.ts:192</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -332,7 +332,7 @@ <h3>del</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/storage.html">Storage</a>.<a href="../interfaces/storage.html#del">del</a></p>
<ul>
<li>Defined in storages/base.ts:130</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L130">storages/base.ts:130</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -360,7 +360,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> execute<wbr>Commands<wb
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:193</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L199">storages/base.ts:199</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -383,7 +383,7 @@ <h3>get</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/storage.html">Storage</a>.<a href="../interfaces/storage.html#get">get</a></p>
<ul>
<li>Defined in storages/base.ts:81</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L81">storages/base.ts:81</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -413,7 +413,7 @@ <h3>get<wbr>Connection<wbr>Status</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/storage.html">Storage</a>.<a href="../interfaces/storage.html#getconnectionstatus">getConnectionStatus</a></p>
<ul>
<li>Defined in storages/base.ts:164</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L170">storages/base.ts:170</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -436,7 +436,7 @@ <h3>get<wbr>Tags</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/storage.html">Storage</a>.<a href="../interfaces/storage.html#gettags">getTags</a></p>
<ul>
<li>Defined in storages/base.ts:138</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L138">storages/base.ts:138</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -465,7 +465,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> is<wbr>Record</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:171</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L177">storages/base.ts:177</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -494,7 +494,7 @@ <h3>key<wbr>IsLocked</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/storage.html">Storage</a>.<a href="../interfaces/storage.html#keyislocked">keyIsLocked</a></p>
<ul>
<li>Defined in storages/base.ts:123</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L123">storages/base.ts:123</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -523,7 +523,7 @@ <h3>lock<wbr>Key</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/storage.html">Storage</a>.<a href="../interfaces/storage.html#lockkey">lockKey</a></p>
<ul>
<li>Defined in storages/base.ts:109</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L109">storages/base.ts:109</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -552,7 +552,7 @@ <h3>release<wbr>Key</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/storage.html">Storage</a>.<a href="../interfaces/storage.html#releasekey">releaseKey</a></p>
<ul>
<li>Defined in storages/base.ts:116</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L116">storages/base.ts:116</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -580,7 +580,7 @@ <h3>set</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:148</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L148">storages/base.ts:148</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -614,7 +614,7 @@ <h3>set<wbr>Tag<wbr>Versions</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in storages/base.ts:94</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L94">storages/base.ts:94</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -643,7 +643,7 @@ <h3>touch</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/storage.html">Storage</a>.<a href="../interfaces/storage.html#touch">touch</a></p>
<ul>
<li>Defined in storages/base.ts:102</li>
<li>Defined in <a href="https://github.com/TinkoffCreditSystems/cachalot/blob/e990f7f/src/storages/base.ts#L102">storages/base.ts:102</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -813,4 +813,4 @@ <h2>Legend</h2>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
</body>
</html>
</html>
Loading

0 comments on commit ca6042d

Please sign in to comment.