Skip to content

Commit 33735e4

Browse files
authored
Merge pull request #6 from yusufshakeel/dev
v1.4.0
2 parents 3eb7f37 + c4be6fa commit 33735e4

File tree

11 files changed

+943
-8
lines changed

11 files changed

+943
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Cache data using JavaScript in the browser.
55
### Status
66

77
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/yusufshakeel/dyCacheJS)
8-
[![npm version](https://img.shields.io/badge/npm-1.3.0-blue.svg)](https://www.npmjs.com/package/dycachejs)
8+
[![npm version](https://img.shields.io/badge/npm-1.4.0-blue.svg)](https://www.npmjs.com/package/dycachejs)
99
[![Build Status](https://travis-ci.org/yusufshakeel/dyCacheJS.svg?branch=master)](https://travis-ci.org/yusufshakeel/dyCacheJS)
1010
[![](https://data.jsdelivr.com/v1/package/npm/dycachejs/badge)](https://www.jsdelivr.com/package/npm/dycachejs)
1111

dist/js/dyCache.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ <h3 class="text-center">Content</h3>
9696
<li><a href="#array-methods">Array Methods</a></li>
9797
<li><a href="#object-methods">Object Methods</a></li>
9898
<li><a href="#stack-methods">Stack Methods</a></li>
99+
<li><a href="#queue-methods">Queue Methods</a></li>
99100
</ul>
100101

101102
<hr>
@@ -1109,6 +1110,272 @@ <h4><code>stackDelete(key)</code></h4>
11091110

11101111
<hr>
11111112

1113+
<a name="queue-methods"></a>
1114+
<h4 class="text-center"><a href="#queue-methods">Queue Methods</a></h4>
1115+
1116+
<!-- queueInit() -->
1117+
<a name="queueInit"></a>
1118+
<h4><code>queueInit(key)</code></h4>
1119+
1120+
<p>This will initialise a queue referred by <code>key</code>
1121+
in the cache.</p>
1122+
1123+
<pre><code>obj.queueInit('myQueue');</code></pre>
1124+
1125+
<div>
1126+
<a class="btn btn-primary"
1127+
role="button"
1128+
data-toggle="collapse"
1129+
href="#collapse-queueInit"
1130+
aria-expanded="false"
1131+
aria-controls="collapse-queueInit">Output</a>
1132+
</div>
1133+
<div class="collapse" id="collapse-queueInit">
1134+
</div>
1135+
1136+
<!-- queueInit() ends here -->
1137+
1138+
<hr>
1139+
1140+
<!-- queueExists() -->
1141+
<a name="queueExists"></a>
1142+
<h4><code>queueExists(key)</code></h4>
1143+
1144+
<p>This will check if the queue referred by <code>key</code>
1145+
exists in the cache.</p>
1146+
1147+
<p>Return <code>true</code> if queue exists. Otherwise, <code>false</code>.</p>
1148+
1149+
<pre><code>obj.queueExists('myQueue');</code></pre>
1150+
1151+
<div>
1152+
<a class="btn btn-primary"
1153+
role="button"
1154+
data-toggle="collapse"
1155+
href="#collapse-queueExists"
1156+
aria-expanded="false"
1157+
aria-controls="collapse-queueExists">Output</a>
1158+
</div>
1159+
<div class="collapse" id="collapse-queueExists">
1160+
</div>
1161+
1162+
<!-- queueExists() ends here -->
1163+
1164+
<hr>
1165+
1166+
<!-- enqueue() -->
1167+
<a name="enqueue"></a>
1168+
<h4><code>enqueue(key, value)</code></h4>
1169+
1170+
<p>This will insert a <code>value</code> from the right side
1171+
in the queue referred by <code>key</code> in the cache.</p>
1172+
1173+
<p><code>value</code> can be a number, string, array or object.</p>
1174+
1175+
<pre><code>obj.enqueue('myQueue', 10); // enqueue number</code></pre>
1176+
<pre><code>obj.enqueue('myQueue', 'Yusuf Shakeel'); // enqueue string</code></pre>
1177+
<pre><code>obj.enqueue('myQueue', [1, 2]); // enqueue array</code></pre>
1178+
<pre><code>obj.enqueue('myQueue', { a: 10 }); // enqueue object</code></pre>
1179+
1180+
<div>
1181+
<a class="btn btn-primary"
1182+
role="button"
1183+
data-toggle="collapse"
1184+
href="#collapse-enqueue"
1185+
aria-expanded="false"
1186+
aria-controls="collapse-enqueue">Output</a>
1187+
</div>
1188+
<div class="collapse" id="collapse-enqueue">
1189+
</div>
1190+
1191+
<!-- enqueue() ends here -->
1192+
1193+
<hr>
1194+
1195+
<!-- dequeue() -->
1196+
<a name="dequeue"></a>
1197+
<h4><code>dequeue(key)</code></h4>
1198+
1199+
<p>This will remove the first element from the left side
1200+
of the queue referred by <code>key</code> in the cache.</p>
1201+
1202+
<p>Will return <code>null</code> if queue does not exists.</p>
1203+
1204+
<pre><code>obj.dequeue('myQueue');</code></pre>
1205+
1206+
<div>
1207+
<a class="btn btn-primary"
1208+
role="button"
1209+
data-toggle="collapse"
1210+
href="#collapse-dequeue"
1211+
aria-expanded="false"
1212+
aria-controls="collapse-dequeue">Output</a>
1213+
</div>
1214+
<div class="collapse" id="collapse-dequeue">
1215+
</div>
1216+
1217+
<!-- dequeue() ends here -->
1218+
1219+
<hr>
1220+
1221+
<!-- queueLPeek() -->
1222+
<a name="queueLPeek"></a>
1223+
<h4><code>queueLPeek(key)</code></h4>
1224+
1225+
<p>This will return the first element from the left side of the
1226+
queue referred by <code>key</code> in the cache.</p>
1227+
1228+
<p>Will return <code>null</code> if queue does not exists.</p>
1229+
1230+
<pre><code>obj.queueLPeek('myQueue');</code></pre>
1231+
1232+
<div>
1233+
<a class="btn btn-primary"
1234+
role="button"
1235+
data-toggle="collapse"
1236+
href="#collapse-queueLPeek"
1237+
aria-expanded="false"
1238+
aria-controls="collapse-queueLPeek">Output</a>
1239+
</div>
1240+
<div class="collapse" id="collapse-queueLPeek">
1241+
</div>
1242+
1243+
<!-- queueLPeek() ends here -->
1244+
1245+
<hr>
1246+
1247+
<!-- queueRPeek() -->
1248+
<a name="queueRPeek"></a>
1249+
<h4><code>queueRPeek(key)</code></h4>
1250+
1251+
<p>This will return the last element from the right side of the
1252+
queue referred by <code>key</code> in the cache.</p>
1253+
1254+
<p>Will return <code>null</code> if queue does not exists.</p>
1255+
1256+
<pre><code>obj.queueRPeek('myQueue');</code></pre>
1257+
1258+
<div>
1259+
<a class="btn btn-primary"
1260+
role="button"
1261+
data-toggle="collapse"
1262+
href="#collapse-queueRPeek"
1263+
aria-expanded="false"
1264+
aria-controls="collapse-queueRPeek">Output</a>
1265+
</div>
1266+
<div class="collapse" id="collapse-queueRPeek">
1267+
</div>
1268+
1269+
<!-- queueRPeek() ends here -->
1270+
1271+
<hr>
1272+
1273+
<!-- queueLength() -->
1274+
<a name="queueLength"></a>
1275+
<h4><code>queueLength(key)</code></h4>
1276+
1277+
<p>This will return total number of elements in the queue referred by
1278+
<code>key</code> in the cache.</p>
1279+
1280+
<p>On success return number of elements in the queue. Otherwise -1.</p>
1281+
1282+
<pre><code>obj.queueLength('myQueue');</code></pre>
1283+
1284+
<div>
1285+
<a class="btn btn-primary"
1286+
role="button"
1287+
data-toggle="collapse"
1288+
href="#collapse-queueLength"
1289+
aria-expanded="false"
1290+
aria-controls="collapse-queueLength">Output</a>
1291+
</div>
1292+
<div class="collapse" id="collapse-queueLength">
1293+
</div>
1294+
1295+
<!-- queueLength() ends here -->
1296+
1297+
<hr>
1298+
1299+
<!-- queueIsEmpty() -->
1300+
<a name="queueIsEmpty"></a>
1301+
<h4><code>queueIsEmpty(key)</code></h4>
1302+
1303+
<p>This will check is the queue referred by
1304+
<code>key</code> in the cache is empty.</p>
1305+
1306+
<p>If empty will return <code>true</code>. Otherwise, <code>false</code>.</p>
1307+
1308+
<p>If <code>key</code> does not exists then return <code>undefined</code>.</p>
1309+
1310+
<pre><code>obj.queueIsEmpty('myQueue');</code></pre>
1311+
1312+
<div>
1313+
<a class="btn btn-primary"
1314+
role="button"
1315+
data-toggle="collapse"
1316+
href="#collapse-queueIsEmpty"
1317+
aria-expanded="false"
1318+
aria-controls="collapse-queueIsEmpty">Output</a>
1319+
</div>
1320+
<div class="collapse" id="collapse-queueIsEmpty">
1321+
</div>
1322+
1323+
<!-- queueIsEmpty() ends here -->
1324+
1325+
<hr>
1326+
1327+
<!-- queuePurge() -->
1328+
<a name="queuePurge"></a>
1329+
<h4><code>queuePurge(key)</code></h4>
1330+
1331+
<p>This will empty the queue referred by
1332+
<code>key</code> in the cache.</p>
1333+
1334+
<p>Will return <code>true</code> on success. Otherwise, <code>false</code>.</p>
1335+
1336+
<pre><code>obj.queuePurge('myQueue');</code></pre>
1337+
1338+
<div>
1339+
<a class="btn btn-primary"
1340+
role="button"
1341+
data-toggle="collapse"
1342+
href="#collapse-queuePurge"
1343+
aria-expanded="false"
1344+
aria-controls="collapse-queuePurge">Output</a>
1345+
</div>
1346+
<div class="collapse" id="collapse-queuePurge">
1347+
</div>
1348+
1349+
<!-- queuePurge() ends here -->
1350+
1351+
<hr>
1352+
1353+
<!-- queueDelete() -->
1354+
<a name="queueDelete"></a>
1355+
<h4><code>queueDelete(key)</code></h4>
1356+
1357+
<p>This will delete the queue referred by
1358+
<code>key</code> from the cache.</p>
1359+
1360+
<p>Will return <code>true</code> on success. Otherwise, <code>false</code>.</p>
1361+
1362+
<pre><code>obj.queueDelete('myQueue');</code></pre>
1363+
1364+
<div>
1365+
<a class="btn btn-primary"
1366+
role="button"
1367+
data-toggle="collapse"
1368+
href="#collapse-queueDelete"
1369+
aria-expanded="false"
1370+
aria-controls="collapse-queueDelete">Output</a>
1371+
</div>
1372+
<div class="collapse" id="collapse-queueDelete">
1373+
</div>
1374+
1375+
<!-- queueDelete() ends here -->
1376+
1377+
<hr>
1378+
11121379

11131380
</div>
11141381

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dycachejs",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"description": "Cache data using JavaScript in the browser.",
55
"main": "index.html",
66
"scripts": {

0 commit comments

Comments
 (0)