sass-site/source/documentation/Sass/CacheStores/Memory.html

644 lines
16 KiB
HTML
Raw Normal View History

2018-10-22 23:13:05 +02:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Class: Sass::CacheStores::Memory
&mdash; Documentation by YARD 0.9.12
</title>
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="../../../assets/css/docs.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
hasFrames = window.top.frames.main ? true : false;
relpath = '../../';
framesUrl = "../../frames.html#!Sass/CacheStores/Memory.html";
</script>
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
</head>
<body>
<div id="header">
<div id="menu">
<a href="../../_index.html">Index (M)</a> &raquo;
<span class='title'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../CacheStores.html" title="Sass::CacheStores (module)">CacheStores</a></span></span>
&raquo;
<span class="title">Memory</span>
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../class_list.html">
Class List
</a>
<a class="full_list_link" id="method_list_link"
href="../../method_list.html">
Method List
</a>
<a class="full_list_link" id="file_list_link"
href="../../file_list.html">
File List
</a>
</div>
<div class="clear"></div>
</div>
<iframe id="search_frame"></iframe>
<div id="content"><h1>Class: Sass::CacheStores::Memory
</h1>
<dl class="box">
<dt class="r1">Inherits:</dt>
<dd class="r1">
<span class="inheritName"><span class='object_link'><a href="Base.html" title="Sass::CacheStores::Base (class)">Base</a></span></span>
<ul class="fullTree">
<li>Object</li>
<li class="next"><span class='object_link'><a href="Base.html" title="Sass::CacheStores::Base (class)">Base</a></span></li>
<li class="next">Sass::CacheStores::Memory</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">.ruby-sass/lib/sass/cache_stores/memory.rb</dd>
</dl>
<div class="clear"></div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>A backend for the Sass cache using in-process memory.</p>
</div>
</div>
<div class="tags">
</div>
<h2>
Class Method Summary
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#_load-class_method" title="_load (class method)">.<strong>_load</strong>(repr) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>If we deserialize this class, just make a new empty one.</p>
</div></span>
</li>
</ul>
<h2>
Instance Method Summary
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#_dump-instance_method" title="#_dump (instance method)">#<strong>_dump</strong>(depth) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Since the <span class='object_link'><a href="" title="Sass::CacheStores::Memory (class)">Memory</a></span> store is stored in the Sass tree&#39;s options hash,
when the options get serialized as part of serializing the tree, you get
crazy exponential growth in the size of the cached objects unless you
don&#39;t dump the cache.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> &#x21d2; Memory </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>Create a new, empty cache store.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#reset!-instance_method" title="#reset! (instance method)">#<strong>reset!</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Destructively clear the cache.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#retrieve-instance_method" title="#retrieve (instance method)">#<strong>retrieve</strong>(key, sha) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#store-instance_method" title="#store (instance method)">#<strong>store</strong>(key, sha, obj) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Base.html" title="Sass::CacheStores::Base (class)">Base</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Base.html#_retrieve-instance_method" title="Sass::CacheStores::Base#_retrieve (method)">#_retrieve</a></span>, <span class='object_link'><a href="Base.html#_store-instance_method" title="Sass::CacheStores::Base#_store (method)">#_store</a></span>, <span class='object_link'><a href="Base.html#key-instance_method" title="Sass::CacheStores::Base#key (method)">#key</a></span></p>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Sass::CacheStores::Memory (class)">Memory</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Create a new, empty cache store.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
23
24
25</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/cache_stores/memory.rb', line 23</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='ivar'>@contents</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Sass::CacheStores::Memory (class)">Memory</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Create a new, empty cache store.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
23
24
25</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/cache_stores/memory.rb', line 23</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='ivar'>@contents</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="class_method_details" class="method_details_list">
<h2>Class Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="_load-class_method">
.<strong>_load</strong>(repr) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>If we deserialize this class, just make a new empty one.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
18
19
20</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/cache_stores/memory.rb', line 18</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__load'>_load</span><span class='lparen'>(</span><span class='id identifier rubyid_repr'>repr</span><span class='rparen'>)</span>
<span class='const'><span class='object_link'><a href="" title="Sass::CacheStores::Memory (class)">Memory</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Sass::CacheStores::Memory#initialize (method)">new</a></span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="_dump-instance_method">
#<strong>_dump</strong>(depth) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Since the <span class='object_link'><a href="" title="Sass::CacheStores::Memory (class)">Sass::CacheStores::Memory</a></span> store is stored in the Sass tree&#39;s options hash,
when the options get serialized as part of serializing the tree, you get
crazy exponential growth in the size of the cached objects unless you
don&#39;t dump the cache.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
11
12
13</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/cache_stores/memory.rb', line 11</span>
<span class='kw'>def</span> <span class='id identifier rubyid__dump'>_dump</span><span class='lparen'>(</span><span class='id identifier rubyid_depth'>depth</span><span class='rparen'>)</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="reset!-instance_method">
#<strong>reset!</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Destructively clear the cache.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
41
42
43</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/cache_stores/memory.rb', line 41</span>
<span class='kw'>def</span> <span class='id identifier rubyid_reset!'>reset!</span>
<span class='ivar'>@contents</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="retrieve-instance_method">
#<strong>retrieve</strong>(key, sha) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">See Also:</p>
<ul class="see">
<li><span class='object_link'><a href="Base.html#retrieve-instance_method" title="Sass::CacheStores::Base#retrieve (method)">Base#retrieve</a></span></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
28
29
30
31
32
33</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/cache_stores/memory.rb', line 28</span>
<span class='kw'>def</span> <span class='id identifier rubyid_retrieve'>retrieve</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_sha'>sha</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='ivar'>@contents</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='ivar'>@contents</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:sha</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_sha'>sha</span>
<span class='id identifier rubyid_obj'>obj</span> <span class='op'>=</span> <span class='ivar'>@contents</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:obj</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:deep_copy</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_deep_copy'>deep_copy</span> <span class='op'>:</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="store-instance_method">
#<strong>store</strong>(key, sha, obj) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">See Also:</p>
<ul class="see">
<li><span class='object_link'><a href="Base.html#store-instance_method" title="Sass::CacheStores::Base#store (method)">Base#store</a></span></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
36
37
38</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/cache_stores/memory.rb', line 36</span>
<span class='kw'>def</span> <span class='id identifier rubyid_store'>store</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_sha'>sha</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
<span class='ivar'>@contents</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='symbol'>:sha</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_sha'>sha</span><span class='comma'>,</span> <span class='symbol'>:obj</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_obj'>obj</span><span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Oct 22 13:20:50 2018 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.12 (ruby-2.5.3).
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-535380-14', 'sass-lang.com');
ga('send', 'pageview');
</script>
</body>
</html>