@@ -50,7 +50,7 @@ outputJSON(obj, 'collapse-set');
5050
5151// set('user', { username: 'yusufshakeel', points: 10 });
5252output ( "Adding a <code>user</code> key having string value <code>{ username: 'yusufshakeel', points: 10 }</code>." , 'collapse-set' ) ;
53- obj . set ( 'user' , { username : 'yusufshakeel' , points : 10 } ) ;
53+ obj . set ( 'user' , { username : 'yusufshakeel' , points : 10 } ) ;
5454outputJSON ( obj , 'collapse-set' ) ;
5555
5656// set('arr', [1, 2, 3]);
@@ -116,7 +116,7 @@ outputJSON(obj, 'collapse-arrPush');
116116
117117// arrMPush();
118118output ( "Push multiple values in an array referred by <code>users</code> key in the cache from the right" , 'collapse-arrMPush' ) ;
119- obj . arrMPush ( 'users' , [ 100 , 'superman' , [ 'a1' , 'b2' , 200 ] , { id : 10 , points : 20 } ] ) ;
119+ obj . arrMPush ( 'users' , [ 100 , 'superman' , [ 'a1' , 'b2' , 200 ] , { id : 10 , points : 20 } ] ) ;
120120output ( "Content of the cache." , 'collapse-arrMPush' ) ;
121121outputJSON ( obj , 'collapse-arrMPush' ) ;
122122
@@ -128,7 +128,7 @@ outputJSON(obj, 'collapse-arrLPush');
128128
129129// arrMLPush();
130130output ( "Push multiple values in an array referred by <code>users</code> key in the cache from the left" , 'collapse-arrMLPush' ) ;
131- obj . arrMLPush ( 'users' , [ 1 , 'hi' , [ 1 , 3 ] , { m : 1 } ] ) ;
131+ obj . arrMLPush ( 'users' , [ 1 , 'hi' , [ 1 , 3 ] , { m : 1 } ] ) ;
132132output ( "Content of the cache." , 'collapse-arrMLPush' ) ;
133133outputJSON ( obj , 'collapse-arrMLPush' ) ;
134134
@@ -169,13 +169,16 @@ outputJSON(obj.arrGet('users'), 'collapse-arrInsertAt');
169169
170170// arrMInsertAt();
171171output ( "Insert multiple values at given <code>index</code> in a array referred by key <code>users</code> in the cache." , 'collapse-arrMInsertAt' ) ;
172- outputJSON ( obj . arrMInsertAt ( 'users' , 1 , [ { id : 9999 , name : 'yusufshakeel' } , 10 , 'happy' , [ 100 ] ] ) , 'collapse-arrMInsertAt' ) ;
172+ outputJSON ( obj . arrMInsertAt ( 'users' , 1 , [ {
173+ id : 9999 ,
174+ name : 'yusufshakeel'
175+ } , 10 , 'happy' , [ 100 ] ] ) , 'collapse-arrMInsertAt' ) ;
173176output ( "Fetch all the elements of the array referred by <code>users</code> key in the cache." , 'collapse-arrMInsertAt' ) ;
174177outputJSON ( obj . arrGet ( 'users' ) , 'collapse-arrMInsertAt' ) ;
175178
176179// arrUpdateElem();
177180output ( "Update value of an element at index 0 in the array referred by key <code>users</code> in the cache." , 'collapse-arrUpdateElem' ) ;
178- outputJSON ( obj . arrUpdateElem ( 'users' , 0 , { username : 'tintin' , points : 50 } ) , 'collapse-arrUpdateElem' ) ;
181+ outputJSON ( obj . arrUpdateElem ( 'users' , 0 , { username : 'tintin' , points : 50 } ) , 'collapse-arrUpdateElem' ) ;
179182output ( "Fetch all the elements of the array referred by <code>users</code> key in the cache." , 'collapse-arrUpdateElem' ) ;
180183outputJSON ( obj . arrGet ( 'users' ) , 'collapse-arrUpdateElem' ) ;
181184
@@ -210,11 +213,11 @@ outputJSON(obj, 'collapse-oInit');
210213
211214// oSet();
212215output ( "This will add <code>p1</code> oKey having value <code>{ id: 'p1', username: 'yusufshakeel' }</code> in the key <code>players</code> of the cache." , 'collapse-oSet' ) ;
213- obj . oSet ( 'players' , 'p1' , { id : 'p1' , username : 'yusufshakeel' } ) ;
216+ obj . oSet ( 'players' , 'p1' , { id : 'p1' , username : 'yusufshakeel' } ) ;
214217output ( "Content of the cache." , 'collapse-oSet' ) ;
215218outputJSON ( obj , 'collapse-oSet' ) ;
216219output ( "This will add <code>p2</code> oKey having value <code>{ id: 'p2', username: 'dawoodshakeel' }</code> in the key <code>players</code> of the cache." , 'collapse-oSet' ) ;
217- obj . oSet ( 'players' , 'p2' , { id : 'p2' , username : 'dawoodshakeel' } ) ;
220+ obj . oSet ( 'players' , 'p2' , { id : 'p2' , username : 'dawoodshakeel' } ) ;
218221output ( "Content of the cache." , 'collapse-oSet' ) ;
219222outputJSON ( obj , 'collapse-oSet' ) ;
220223
@@ -272,7 +275,7 @@ obj.stackPush('myStack', 'Yusuf Shakeel');
272275output ( "Push array value in stack referred by key <code>myStack</code> in the cache." , 'collapse-stackPush' ) ;
273276obj . stackPush ( 'myStack' , [ 1 , 2 ] ) ;
274277output ( "Push object value in stack referred by key <code>myStack</code> in the cache." , 'collapse-stackPush' ) ;
275- obj . stackPush ( 'myStack' , { a : 10 } ) ;
278+ obj . stackPush ( 'myStack' , { a : 10 } ) ;
276279output ( "Content of the cache." , 'collapse-stackPush' ) ;
277280outputJSON ( obj , 'collapse-stackPush' ) ;
278281
@@ -329,7 +332,7 @@ obj.enqueue('myQueue', 'Yusuf Shakeel');
329332output ( "Enqueue array value from the right side in queue referred by key <code>myQueue</code> in the cache." , 'collapse-enqueue' ) ;
330333obj . enqueue ( 'myQueue' , [ 1 , 2 ] ) ;
331334output ( "Enqueue object value from the right side in queue referred by key <code>myQueue</code> in the cache." , 'collapse-enqueue' ) ;
332- obj . enqueue ( 'myQueue' , { a : 10 } ) ;
335+ obj . enqueue ( 'myQueue' , { a : 10 } ) ;
333336output ( "Content of the cache." , 'collapse-enqueue' ) ;
334337outputJSON ( obj , 'collapse-enqueue' ) ;
335338
@@ -401,6 +404,13 @@ output("Content of the cache after <code>LRUGet</code> operation.", 'collapse-LR
401404outputJSON ( obj , 'collapse-LRUGet' ) ;
402405output ( "Note! 'k1' is moved from last index to 0th index in the queue after <code>LRUGet</code> operation." , 'collapse-LRUGet' ) ;
403406
407+ // LRUResize();
408+ output ( "Content of the cache before <code>LRUResize</code> operation." , 'collapse-LRUResize' ) ;
409+ outputJSON ( obj , 'collapse-LRUResize' ) ;
410+ obj . LRUResize ( 'myLRU' , 2 ) ;
411+ output ( "Content of the cache after <code>LRUResize</code> operation." , 'collapse-LRUResize' ) ;
412+ outputJSON ( obj , 'collapse-LRUResize' ) ;
413+
404414// LRUPurge();
405415output ( "Content of the cache before <code>LRUPurge</code> operation." , 'collapse-LRUPurge' ) ;
406416outputJSON ( obj , 'collapse-LRUPurge' ) ;
0 commit comments