doc/SidekiqUniqueJobs/Lock.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Class: SidekiqUniqueJobs::Lock
— Documentation by YARD 0.9.26
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "SidekiqUniqueJobs::Lock";
relpath = '../';
</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 class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (L)</a> »
<span class='title'><span class='object_link'><a href="../SidekiqUniqueJobs.html" title="SidekiqUniqueJobs (module)">SidekiqUniqueJobs</a></span></span>
»
<span class="title">Lock</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Class: SidekiqUniqueJobs::Lock
</h1>
<div class="box_info">
<dl>
<dt>Inherits:</dt>
<dd>
<span class="inheritName">Object</span>
<ul class="fullTree">
<li>Object</li>
<li class="next">SidekiqUniqueJobs::Lock</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Includes:</dt>
<dd><span class='object_link'><a href="Connection.html" title="SidekiqUniqueJobs::Connection (module)">Connection</a></span>, <span class='object_link'><a href="JSON.html" title="SidekiqUniqueJobs::JSON (module)">JSON</a></span>, <span class='object_link'><a href="Timing.html" title="SidekiqUniqueJobs::Timing (module)">Timing</a></span></dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/sidekiq_unique_jobs/lock.rb<span class="defines">,<br />
lib/sidekiq_unique_jobs/lock/base_lock.rb,<br /> lib/sidekiq_unique_jobs/lock/validator.rb,<br /> lib/sidekiq_unique_jobs/lock/until_expired.rb,<br /> lib/sidekiq_unique_jobs/lock/until_executed.rb,<br /> lib/sidekiq_unique_jobs/lock/until_executing.rb,<br /> lib/sidekiq_unique_jobs/lock/while_executing.rb,<br /> lib/sidekiq_unique_jobs/lock/client_validator.rb,<br /> lib/sidekiq_unique_jobs/lock/server_validator.rb,<br /> lib/sidekiq_unique_jobs/lock/while_executing_reject.rb,<br /> lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb</span>
</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Class Lock provides access to information about a lock</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Author:</p>
<ul class="author">
<li>
<div class='inline'><p>Mikael Henriksson <a href="mailto:mikael@mhenrixon.com">mikael@mhenrixon.com</a></p>
</div>
</li>
</ul>
</div><h2>Defined Under Namespace</h2>
<p class="children">
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Lock/BaseLock.html" title="SidekiqUniqueJobs::Lock::BaseLock (class)">BaseLock</a></span>, <span class='object_link'><a href="Lock/ClientValidator.html" title="SidekiqUniqueJobs::Lock::ClientValidator (class)">ClientValidator</a></span>, <span class='object_link'><a href="Lock/ServerValidator.html" title="SidekiqUniqueJobs::Lock::ServerValidator (class)">ServerValidator</a></span>, <span class='object_link'><a href="Lock/UntilAndWhileExecuting.html" title="SidekiqUniqueJobs::Lock::UntilAndWhileExecuting (class)">UntilAndWhileExecuting</a></span>, <span class='object_link'><a href="Lock/UntilExecuted.html" title="SidekiqUniqueJobs::Lock::UntilExecuted (class)">UntilExecuted</a></span>, <span class='object_link'><a href="Lock/UntilExecuting.html" title="SidekiqUniqueJobs::Lock::UntilExecuting (class)">UntilExecuting</a></span>, <span class='object_link'><a href="Lock/UntilExpired.html" title="SidekiqUniqueJobs::Lock::UntilExpired (class)">UntilExpired</a></span>, <span class='object_link'><a href="Lock/Validator.html" title="SidekiqUniqueJobs::Lock::Validator (class)">Validator</a></span>, <span class='object_link'><a href="Lock/WhileExecuting.html" title="SidekiqUniqueJobs::Lock::WhileExecuting (class)">WhileExecuting</a></span>, <span class='object_link'><a href="Lock/WhileExecutingReject.html" title="SidekiqUniqueJobs::Lock::WhileExecutingReject (class)">WhileExecutingReject</a></span>
</p>
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#key-instance_method" title="#key (instance method)">#<strong>key</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute key.</p>
</div></span>
</li>
</ul>
<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="#create-class_method" title="create (class method)">.<strong>create</strong>(digest, job_id, lock_info = {}) ⇒ Lock </a>
</span>
<span class="summary_desc"><div class='inline'><p>Initialize a locked lock.</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="#all_jids-instance_method" title="#all_jids (instance method)">#<strong>all_jids</strong> ⇒ Array<String> </a>
</span>
<span class="summary_desc"><div class='inline'><p>Returns all job_id's for this lock.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#changelog-instance_method" title="#changelog (instance method)">#<strong>changelog</strong> ⇒ Changelog </a>
</span>
<span class="summary_desc"><div class='inline'><p>A sorted set with changelog entries.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#changelogs-instance_method" title="#changelogs (instance method)">#<strong>changelogs</strong> ⇒ Array<Hash> </a>
</span>
<span class="summary_desc"><div class='inline'><p>Returns all matching changelog entries for this lock.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#created_at-instance_method" title="#created_at (instance method)">#<strong>created_at</strong> ⇒ Float </a>
</span>
<span class="summary_desc"><div class='inline'><p>Returns either the time the lock was initialized with or the first changelog entry's timestamp.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#del-instance_method" title="#del (instance method)">#<strong>del</strong> ⇒ Integer </a>
</span>
<span class="summary_desc"><div class='inline'><p>Deletes all the redis keys for this lock.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#digest-instance_method" title="#digest (instance method)">#<strong>digest</strong> ⇒ Redis::String </a>
</span>
<span class="summary_desc"><div class='inline'><p>The digest key.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#info-instance_method" title="#info (instance method)">#<strong>info</strong> ⇒ Redis::Hash </a>
</span>
<span class="summary_desc"><div class='inline'><p>Information about the lock.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(key, time: nil) ⇒ Lock </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'><p>Initialize a new lock.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#inspect-instance_method" title="#inspect (instance method)">#<strong>inspect</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#lock-instance_method" title="#lock (instance method)">#<strong>lock</strong>(job_id, lock_info = {}) ⇒ void </a>
</span>
<span class="summary_desc"><div class='inline'><p>Locks a job_id.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#locked-instance_method" title="#locked (instance method)">#<strong>locked</strong> ⇒ Redis::Hash </a>
</span>
<span class="summary_desc"><div class='inline'><p>The locked hash.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#locked_jids-instance_method" title="#locked_jids (instance method)">#<strong>locked_jids</strong>(with_values: false) ⇒ Hash<String, Float>, Array<String> </a>
</span>
<span class="summary_desc"><div class='inline'><p>Returns a collection of locked job_id's.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#prime-instance_method" title="#prime (instance method)">#<strong>prime</strong>(job_id) ⇒ void </a>
</span>
<span class="summary_desc"><div class='inline'><p>Create the :PRIMED key.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#primed-instance_method" title="#primed (instance method)">#<strong>primed</strong> ⇒ Redis::List </a>
</span>
<span class="summary_desc"><div class='inline'><p>The primed list.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#primed_jids-instance_method" title="#primed_jids (instance method)">#<strong>primed_jids</strong> ⇒ Array<String> </a>
</span>
<span class="summary_desc"><div class='inline'><p>Returns the primed JIDs.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#queue-instance_method" title="#queue (instance method)">#<strong>queue</strong>(job_id) ⇒ void </a>
</span>
<span class="summary_desc"><div class='inline'><p>Create the :QUEUED key.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#queued-instance_method" title="#queued (instance method)">#<strong>queued</strong> ⇒ Redis::List </a>
</span>
<span class="summary_desc"><div class='inline'><p>The queued list.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#queued_jids-instance_method" title="#queued_jids (instance method)">#<strong>queued_jids</strong> ⇒ Array<String> </a>
</span>
<span class="summary_desc"><div class='inline'><p>Returns the queued JIDs.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#redis-instance_method" title="#redis (instance method)">#<strong>redis</strong>(r_pool = nil, &block) ⇒ Sidekiq::RedisConnection, ConnectionPool </a>
</span>
<span class="note title not_defined_here">
included
from <span class='object_link'><a href="Connection.html#redis-instance_method" title="SidekiqUniqueJobs::Connection#redis (method)">Connection</a></span>
</span>
<span class="summary_desc"><div class='inline'><p>Creates a connection to redis.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> ⇒ String </a>
</span>
<span class="summary_desc"><div class='inline'><p>A nicely formatted string with information about this lock.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#unlock-instance_method" title="#unlock (instance method)">#<strong>unlock</strong>(job_id) ⇒ true, false </a>
</span>
<span class="summary_desc"><div class='inline'><p>Unlock a specific job_id.</p>
</div></span>
</li>
</ul>
<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>(key, time: nil) ⇒ <tt><span class='object_link'><a href="" title="SidekiqUniqueJobs::Lock (class)">Lock</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Initialize a new lock</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>key</span>
<span class='type'>(<tt>String</tt>, <tt><span class='object_link'><a href="Key.html" title="SidekiqUniqueJobs::Key (class)">Key</a></span></tt>)</span>
—
<div class='inline'><p>either a digest or an instance of a <span class='object_link'><a href="Key.html" title="SidekiqUniqueJobs::Key (class)">Key</a></span></p>
</div>
</li>
<li>
<span class='name'>time</span>
<span class='type'>(<tt>Timstamp</tt>, <tt>Float</tt>)</span>
<em class="default">(defaults to: <tt>nil</tt>)</em>
—
<div class='inline'><p>nil optional timestamp to initiate this lock with</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
48
49
50
51</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 48</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>time:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
<span class='ivar'>@key</span> <span class='op'>=</span> <span class='id identifier rubyid_get_key'>get_key</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
<span class='ivar'>@created_at</span> <span class='op'>=</span> <span class='id identifier rubyid_time'>time</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Float</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_time'>time</span> <span class='op'>:</span> <span class='id identifier rubyid_time'>time</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_attr_details" class="attr_details">
<h2>Instance Attribute Details</h2>
<span id=""></span>
<div class="method_details first">
<h3 class="signature first" id="key-instance_method">
#<strong>key</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute key.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
25
26
27</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 25</span>
<span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
<span class='ivar'>@key</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="create-class_method">
.<strong>create</strong>(digest, job_id, lock_info = {}) ⇒ <tt><span class='object_link'><a href="" title="SidekiqUniqueJobs::Lock (class)">Lock</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Initialize a locked lock</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>digest</span>
<span class='type'>(<tt>String</tt>)</span>
—
<div class='inline'><p>a unique digest</p>
</div>
</li>
<li>
<span class='name'>job_id</span>
<span class='type'>(<tt>String</tt>)</span>
—
<div class='inline'><p>a sidekiq JID</p>
</div>
</li>
<li>
<span class='name'>lock_info</span>
<span class='type'>(<tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt>)</span>
<em class="default">(defaults to: <tt>{}</tt>)</em>
—
<div class='inline'><p>information about the lock</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="" title="SidekiqUniqueJobs::Lock (class)">Lock</a></span></tt>)</span>
—
<div class='inline'><p>a newly lock that has been locked</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
36
37
38
39
40</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 36</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_digest'>digest</span><span class='comma'>,</span> <span class='id identifier rubyid_job_id'>job_id</span><span class='comma'>,</span> <span class='id identifier rubyid_lock_info'>lock_info</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='id identifier rubyid_lock'>lock</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_digest'>digest</span><span class='comma'>,</span> <span class='label'>time:</span> <span class='const'><span class='object_link'><a href="Timing.html" title="SidekiqUniqueJobs::Timing (module)">Timing</a></span></span><span class='period'>.</span><span class='id identifier rubyid_now_f'><span class='object_link'><a href="Timing.html#now_f-class_method" title="SidekiqUniqueJobs::Timing.now_f (method)">now_f</a></span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_lock'>lock</span><span class='period'>.</span><span class='id identifier rubyid_lock'>lock</span><span class='lparen'>(</span><span class='id identifier rubyid_job_id'>job_id</span><span class='comma'>,</span> <span class='id identifier rubyid_lock_info'>lock_info</span><span class='rparen'>)</span>
<span class='id identifier rubyid_lock'>lock</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="all_jids-instance_method">
#<strong>all_jids</strong> ⇒ <tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span><String></tt>
</h3><div class="docstring">
<div class="discussion">
<div class="note notetag">
<strong>Note:</strong>
<div class='inline'><p>a JID can be present in 3 different places</p>
</div>
</div>
<p>Returns all job_id's for this lock</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span><String></tt>)</span>
—
<div class='inline'><p>an array with JIDs</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
152
153
154</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 152</span>
<span class='kw'>def</span> <span class='id identifier rubyid_all_jids'>all_jids</span>
<span class='lparen'>(</span><span class='id identifier rubyid_queued_jids'>queued_jids</span> <span class='op'>+</span> <span class='id identifier rubyid_primed_jids'>primed_jids</span> <span class='op'>+</span> <span class='id identifier rubyid_locked_jids'>locked_jids</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="changelog-instance_method">
#<strong>changelog</strong> ⇒ <tt><span class='object_link'><a href="Changelog.html" title="SidekiqUniqueJobs::Changelog (class)">Changelog</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>A sorted set with changelog entries</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="Changelog.html" title="SidekiqUniqueJobs::Changelog (class)">Changelog</a></span></tt>)</span>
</li>
</ul>
<p class="tag_title">See Also:</p>
<ul class="see">
<li><span class='object_link'><a href="Changelog.html" title="SidekiqUniqueJobs::Changelog (class)">for more information</a></span></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
259
260
261</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 259</span>
<span class='kw'>def</span> <span class='id identifier rubyid_changelog'>changelog</span>
<span class='ivar'>@changelog</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="Changelog.html" title="SidekiqUniqueJobs::Changelog (class)">Changelog</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Changelog.html#initialize-instance_method" title="SidekiqUniqueJobs::Changelog#initialize (method)">new</a></span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="changelogs-instance_method">
#<strong>changelogs</strong> ⇒ <tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span><<span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span>></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns all matching changelog entries for this lock</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span><<span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span>></tt>)</span>
—
<div class='inline'><p>an array with changelogs</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
194
195
196</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 194</span>
<span class='kw'>def</span> <span class='id identifier rubyid_changelogs'>changelogs</span>
<span class='id identifier rubyid_changelog'>changelog</span><span class='period'>.</span><span class='id identifier rubyid_entries'>entries</span><span class='lparen'>(</span><span class='label'>pattern:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_digest'>digest</span><span class='embexpr_end'>}</span><span class='tstring_content'>*</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="created_at-instance_method">
#<strong>created_at</strong> ⇒ <tt>Float</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns either the time the lock was initialized with or
the first changelog entry's timestamp</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Float</tt>)</span>
—
<div class='inline'><p>a floaty timestamp represantation</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
140
141
142</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 140</span>
<span class='kw'>def</span> <span class='id identifier rubyid_created_at'>created_at</span>
<span class='ivar'>@created_at</span> <span class='op'>||=</span> <span class='id identifier rubyid_changelogs'>changelogs</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='op'>&.</span><span class='op'>[]</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>time</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="del-instance_method">
#<strong>del</strong> ⇒ <tt>Integer</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Deletes all the redis keys for this lock</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Integer</tt>)</span>
—
<div class='inline'><p>the number of keys deleted in redis</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
124
125
126
127
128
129
130
131</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 124</span>
<span class='kw'>def</span> <span class='id identifier rubyid_del'>del</span>
<span class='id identifier rubyid_redis'>redis</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_conn'>conn</span><span class='op'>|</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_multi'>multi</span> <span class='kw'>do</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_zrem'>zrem</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#DIGESTS-constant" title="SidekiqUniqueJobs::DIGESTS (constant)">DIGESTS</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_digest'>digest</span><span class='rparen'>)</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_del'>del</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_digest'>digest</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_queued'>queued</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_primed'>primed</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_locked'>locked</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="digest-instance_method">
#<strong>digest</strong> ⇒ <tt><span class='object_link'><a href="Redis/String.html" title="SidekiqUniqueJobs::Redis::String (class)">Redis::String</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<div class="note notetag">
<strong>Note:</strong>
<div class='inline'><p>Used for exists checks to avoid enqueuing
the same lock twice</p>
</div>
</div>
<p>The digest key</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="Redis/String.html" title="SidekiqUniqueJobs::Redis::String (class)">Redis::String</a></span></tt>)</span>
—
<div class='inline'><p>a string representation of the key</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
207
208
209</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 207</span>
<span class='kw'>def</span> <span class='id identifier rubyid_digest'>digest</span>
<span class='ivar'>@digest</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="Redis.html" title="SidekiqUniqueJobs::Redis (module)">Redis</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Redis/String.html" title="SidekiqUniqueJobs::Redis::String (class)">String</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Redis/Entity.html#initialize-instance_method" title="SidekiqUniqueJobs::Redis::Entity#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_digest'>digest</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="info-instance_method">
#<strong>info</strong> ⇒ <tt><span class='object_link'><a href="Redis/Hash.html" title="SidekiqUniqueJobs::Redis::Hash (class)">Redis::Hash</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Information about the lock</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="Redis/Hash.html" title="SidekiqUniqueJobs::Redis::Hash (class)">Redis::Hash</a></span></tt>)</span>
—
<div class='inline'><p>with lock information</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
247
248
249</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 247</span>
<span class='kw'>def</span> <span class='id identifier rubyid_info'>info</span>
<span class='ivar'>@info</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="LockInfo.html" title="SidekiqUniqueJobs::LockInfo (class)">LockInfo</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Redis/Entity.html#initialize-instance_method" title="SidekiqUniqueJobs::Redis::Entity#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="inspect-instance_method">
#<strong>inspect</strong> ⇒ <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="#to_s-instance_method" title="SidekiqUniqueJobs::Lock#to_s (method)">#to_s</a></span></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
285
286
287</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 285</span>
<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
<span class='id identifier rubyid_to_s'>to_s</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="lock-instance_method">
#<strong>lock</strong>(job_id, lock_info = {}) ⇒ <tt>void</tt>
</h3><div class="docstring">
<div class="discussion">
<div class="note notetag">
<strong>Note:</strong>
<div class='inline'><p>intended only for testing purposes</p>
</div>
</div>
<p class="note returns_void">This method returns an undefined value.</p><p>Locks a job_id</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>job_id</span>
<span class='type'>(<tt>String</tt>)</span>
—
<div class='inline'><p>a sidekiq JID</p>
</div>
</li>
<li>
<span class='name'>lock_info</span>
<span class='type'>(<tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt>)</span>
<em class="default">(defaults to: <tt>{}</tt>)</em>
—
<div class='inline'><p>information about the lock</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
63
64
65
66
67
68
69
70
71
72
73
74</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 63</span>
<span class='kw'>def</span> <span class='id identifier rubyid_lock'>lock</span><span class='lparen'>(</span><span class='id identifier rubyid_job_id'>job_id</span><span class='comma'>,</span> <span class='id identifier rubyid_lock_info'>lock_info</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='id identifier rubyid_redis'>redis</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_conn'>conn</span><span class='op'>|</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_multi'>multi</span> <span class='kw'>do</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_set'>set</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_digest'>digest</span><span class='comma'>,</span> <span class='id identifier rubyid_job_id'>job_id</span><span class='rparen'>)</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_hset'>hset</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_locked'>locked</span><span class='comma'>,</span> <span class='id identifier rubyid_job_id'>job_id</span><span class='comma'>,</span> <span class='id identifier rubyid_now_f'>now_f</span><span class='rparen'>)</span>
<span class='id identifier rubyid_info'>info</span><span class='period'>.</span><span class='id identifier rubyid_set'>set</span><span class='lparen'>(</span><span class='id identifier rubyid_lock_info'>lock_info</span><span class='rparen'>)</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_zadd'>zadd</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_digests'>digests</span><span class='comma'>,</span> <span class='id identifier rubyid_now_f'>now_f</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_digest'>digest</span><span class='rparen'>)</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_zadd'>zadd</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_changelog'>changelog</span><span class='comma'>,</span> <span class='id identifier rubyid_now_f'>now_f</span><span class='comma'>,</span> <span class='id identifier rubyid_changelog_json'>changelog_json</span><span class='lparen'>(</span><span class='id identifier rubyid_job_id'>job_id</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>queue.lua</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Queued</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_zadd'>zadd</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_changelog'>changelog</span><span class='comma'>,</span> <span class='id identifier rubyid_now_f'>now_f</span><span class='comma'>,</span> <span class='id identifier rubyid_changelog_json'>changelog_json</span><span class='lparen'>(</span><span class='id identifier rubyid_job_id'>job_id</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>lock.lua</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Locked</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="locked-instance_method">
#<strong>locked</strong> ⇒ <tt><span class='object_link'><a href="Redis/Hash.html" title="SidekiqUniqueJobs::Redis::Hash (class)">Redis::Hash</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>The locked hash</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="Redis/Hash.html" title="SidekiqUniqueJobs::Redis::Hash (class)">Redis::Hash</a></span></tt>)</span>
—
<div class='inline'><p>for locked JIDs</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
237
238
239</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 237</span>
<span class='kw'>def</span> <span class='id identifier rubyid_locked'>locked</span>
<span class='ivar'>@locked</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="Redis.html" title="SidekiqUniqueJobs::Redis (module)">Redis</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Redis/Hash.html" title="SidekiqUniqueJobs::Redis::Hash (class)">Hash</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Redis/Entity.html#initialize-instance_method" title="SidekiqUniqueJobs::Redis::Entity#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_locked'>locked</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="locked_jids-instance_method">
#<strong>locked_jids</strong>(with_values: false) ⇒ <tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span><String, Float></tt>, <tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span><String></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a collection of locked job_id's</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>with_values</span>
<span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
<em class="default">(defaults to: <tt>false</tt>)</em>
—
<div class='inline'><p>false provide the timestamp for the lock</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span><String, Float></tt>)</span>
—
<div class='inline'><p>when given <code>with_values: true</code></p>
</div>
</li>
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span><String></tt>)</span>
—
<div class='inline'><p>when given <code>with_values: false</code></p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
164
165
166</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 164</span>
<span class='kw'>def</span> <span class='id identifier rubyid_locked_jids'>locked_jids</span><span class='lparen'>(</span><span class='label'>with_values:</span> <span class='kw'>false</span><span class='rparen'>)</span>
<span class='id identifier rubyid_locked'>locked</span><span class='period'>.</span><span class='id identifier rubyid_entries'>entries</span><span class='lparen'>(</span><span class='label'>with_values:</span> <span class='id identifier rubyid_with_values'>with_values</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="prime-instance_method">
#<strong>prime</strong>(job_id) ⇒ <tt>void</tt>
</h3><div class="docstring">
<div class="discussion">
<div class="note notetag">
<strong>Note:</strong>
<div class='inline'><p>intended only for testing purposes</p>
</div>
</div>
<p class="note returns_void">This method returns an undefined value.</p><p>Create the :PRIMED key</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>job_id</span>
<span class='type'>(<tt>String</tt>)</span>
—
<div class='inline'><p>a sidekiq JID</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
100
101
102
103
104</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 100</span>
<span class='kw'>def</span> <span class='id identifier rubyid_prime'>prime</span><span class='lparen'>(</span><span class='id identifier rubyid_job_id'>job_id</span><span class='rparen'>)</span>
<span class='id identifier rubyid_redis'>redis</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_conn'>conn</span><span class='op'>|</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_lpush'>lpush</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_primed'>primed</span><span class='comma'>,</span> <span class='id identifier rubyid_job_id'>job_id</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="primed-instance_method">
#<strong>primed</strong> ⇒ <tt><span class='object_link'><a href="Redis/List.html" title="SidekiqUniqueJobs::Redis::List (class)">Redis::List</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>The primed list</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="Redis/List.html" title="SidekiqUniqueJobs::Redis::List (class)">Redis::List</a></span></tt>)</span>
—
<div class='inline'><p>for primed JIDs</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
227
228
229</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 227</span>
<span class='kw'>def</span> <span class='id identifier rubyid_primed'>primed</span>
<span class='ivar'>@primed</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="Redis.html" title="SidekiqUniqueJobs::Redis (module)">Redis</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Redis/List.html" title="SidekiqUniqueJobs::Redis::List (class)">List</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Redis/Entity.html#initialize-instance_method" title="SidekiqUniqueJobs::Redis::Entity#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_primed'>primed</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="primed_jids-instance_method">
#<strong>primed_jids</strong> ⇒ <tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span><String></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the primed JIDs</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span><String></tt>)</span>
—
<div class='inline'><p>an array with primed job_ids</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
184
185
186</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 184</span>
<span class='kw'>def</span> <span class='id identifier rubyid_primed_jids'>primed_jids</span>
<span class='id identifier rubyid_primed'>primed</span><span class='period'>.</span><span class='id identifier rubyid_entries'>entries</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="queue-instance_method">
#<strong>queue</strong>(job_id) ⇒ <tt>void</tt>
</h3><div class="docstring">
<div class="discussion">
<div class="note notetag">
<strong>Note:</strong>
<div class='inline'><p>intended only for testing purposes</p>
</div>
</div>
<p class="note returns_void">This method returns an undefined value.</p><p>Create the :QUEUED key</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>job_id</span>
<span class='type'>(<tt>String</tt>)</span>
—
<div class='inline'><p>a sidekiq JID</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
85
86
87
88
89</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 85</span>
<span class='kw'>def</span> <span class='id identifier rubyid_queue'>queue</span><span class='lparen'>(</span><span class='id identifier rubyid_job_id'>job_id</span><span class='rparen'>)</span>
<span class='id identifier rubyid_redis'>redis</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_conn'>conn</span><span class='op'>|</span>
<span class='id identifier rubyid_conn'>conn</span><span class='period'>.</span><span class='id identifier rubyid_lpush'>lpush</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_queued'>queued</span><span class='comma'>,</span> <span class='id identifier rubyid_job_id'>job_id</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="queued-instance_method">
#<strong>queued</strong> ⇒ <tt><span class='object_link'><a href="Redis/List.html" title="SidekiqUniqueJobs::Redis::List (class)">Redis::List</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>The queued list</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="Redis/List.html" title="SidekiqUniqueJobs::Redis::List (class)">Redis::List</a></span></tt>)</span>
—
<div class='inline'><p>for queued JIDs</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
217
218
219</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 217</span>
<span class='kw'>def</span> <span class='id identifier rubyid_queued'>queued</span>
<span class='ivar'>@queued</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="Redis.html" title="SidekiqUniqueJobs::Redis (module)">Redis</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Redis/List.html" title="SidekiqUniqueJobs::Redis::List (class)">List</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Redis/Entity.html#initialize-instance_method" title="SidekiqUniqueJobs::Redis::Entity#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_queued'>queued</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="queued_jids-instance_method">
#<strong>queued_jids</strong> ⇒ <tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span><String></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the queued JIDs</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span><String></tt>)</span>
—
<div class='inline'><p>an array with queued job_ids</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
174
175
176</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 174</span>
<span class='kw'>def</span> <span class='id identifier rubyid_queued_jids'>queued_jids</span>
<span class='id identifier rubyid_queued'>queued</span><span class='period'>.</span><span class='id identifier rubyid_entries'>entries</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="redis-instance_method">
#<strong>redis</strong>(r_pool = nil, &block) ⇒ <tt>Sidekiq::RedisConnection</tt>, <tt>ConnectionPool</tt>
<span class="not_defined_here">
Originally defined in module
<span class='object_link'><a href="Connection.html#redis-instance_method" title="SidekiqUniqueJobs::Connection#redis (method)">Connection</a></span>
</span>
</h3><div class="docstring">
<div class="discussion">
<p>Creates a connection to redis</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Sidekiq::RedisConnection</tt>, <tt>ConnectionPool</tt>)</span>
—
<div class='inline'><p>a connection to redis</p>
</div>
</li>
</ul>
</div>
</div>
<div class="method_details ">
<h3 class="signature " id="to_s-instance_method">
#<strong>to_s</strong> ⇒ <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>A nicely formatted string with information about this lock</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
269
270
271
272
273
274
275
276
277
278
279
280</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 269</span>
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
<span class='heredoc_beg'><<~MESSAGE</span>
<span class='tstring_content'> Lock status for </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>
</span><span class='tstring_content'>
</span><span class='tstring_content'> value: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_digest'>digest</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='embexpr_end'>}</span><span class='tstring_content'>
</span><span class='tstring_content'> info: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_info'>info</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='embexpr_end'>}</span><span class='tstring_content'>
</span><span class='tstring_content'> queued_jids: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_queued_jids'>queued_jids</span><span class='embexpr_end'>}</span><span class='tstring_content'>
</span><span class='tstring_content'> primed_jids: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_primed_jids'>primed_jids</span><span class='embexpr_end'>}</span><span class='tstring_content'>
</span><span class='tstring_content'> locked_jids: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_locked_jids'>locked_jids</span><span class='embexpr_end'>}</span><span class='tstring_content'>
</span><span class='tstring_content'> changelogs: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_changelogs'>changelogs</span><span class='embexpr_end'>}</span><span class='tstring_content'>
</span><span class='heredoc_end'> MESSAGE
</span><span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="unlock-instance_method">
#<strong>unlock</strong>(job_id) ⇒ <tt>true</tt>, <tt>false</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Unlock a specific job_id</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>job_id</span>
<span class='type'>(<tt>String</tt>)</span>
—
<div class='inline'><p>a sidekiq JID</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>true</tt>)</span>
—
<div class='inline'><p>when job_id was removed</p>
</div>
</li>
<li>
<span class='type'>(<tt>false</tt>)</span>
—
<div class='inline'><p>when job_id wasn't locked</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
114
115
116</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock.rb', line 114</span>
<span class='kw'>def</span> <span class='id identifier rubyid_unlock'>unlock</span><span class='lparen'>(</span><span class='id identifier rubyid_job_id'>job_id</span><span class='rparen'>)</span>
<span class='id identifier rubyid_locked'>locked</span><span class='period'>.</span><span class='id identifier rubyid_del'>del</span><span class='lparen'>(</span><span class='id identifier rubyid_job_id'>job_id</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Sep 27 15:29:06 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-3.0.2).
</div>
</div>
</body>
</html>