Skip to content

Commit

Permalink
Cleanup cache properly
Browse files Browse the repository at this point in the history
There seems to be no way to cleanup the entire cache efficiently. Modify the removeData function to optionally do so. 

Ref: julianshapiro#644 (comment)
  • Loading branch information
prasannavl committed Feb 25, 2016
1 parent 9c9c052 commit b1668fd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions velocity.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,15 @@
store = id && cache[id];

if (store) {
$.each(keys, function(_, key) {
delete store[key];
});
// Cleanup the entire store if no keys are provided.
if (!keys) {
delete cache[id];
}
else {
$.each(keys, function (_, key) {
delete store[key];
});
}
}
};

Expand Down Expand Up @@ -3883,4 +3889,4 @@ return function (global, window, document, undefined) {

/* The CSS spec mandates that the translateX/Y/Z transforms are %-relative to the element itself -- not its parent.
Velocity, however, doesn't make this distinction. Thus, converting to or from the % unit with these subproperties
will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */
will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */

0 comments on commit b1668fd

Please sign in to comment.