flat-cache 1.2.2 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,6 +24,9 @@ cache.setKey('key', { foo: 'var' });
24
24
  // get a key from the cache
25
25
  cache.getKey('key') // { foo: 'var' }
26
26
 
27
+ // fetch the entire persisted object
28
+ cache.all() // { 'key': { foo: 'var' } }
29
+
27
30
  // remove a key
28
31
  cache.removeKey('key'); // removes a key from the cache
29
32
 
@@ -68,4 +71,3 @@ MIT
68
71
  ## Changelog
69
72
 
70
73
  [changelog](./changelog.md)
71
-
package/cache.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var path = require( 'path' );
2
2
  var fs = require( 'graceful-fs' );
3
- var del = require( 'del' ).sync;
4
3
  var utils = require( './utils' );
4
+ var del = require( './del' );
5
5
  var writeJSON = utils.writeJSON;
6
6
 
7
7
  var cache = {
@@ -39,6 +39,15 @@ var cache = {
39
39
  me.load( fName, dir );
40
40
  },
41
41
 
42
+ /**
43
+ * Returns the entire persisted object
44
+ * @method all
45
+ * @returns {*}
46
+ */
47
+ all: function () {
48
+ return this._persisted;
49
+ },
50
+
42
51
  keys: function () {
43
52
  return Object.keys( this._persisted );
44
53
  },
@@ -116,7 +125,7 @@ var cache = {
116
125
  * @return {Boolean} true or false if the file was successfully deleted
117
126
  */
118
127
  removeCacheFile: function () {
119
- return del( this._pathToFile, { force: true } );
128
+ return del( this._pathToFile );
120
129
  },
121
130
  /**
122
131
  * Destroy the file cache and cache content.
@@ -174,7 +183,7 @@ module.exports = {
174
183
  */
175
184
  clearCacheById: function ( docId, cacheDir ) {
176
185
  var filePath = cacheDir ? path.resolve( cacheDir, docId ) : path.resolve( __dirname, './.cache/', docId );
177
- return del( filePath, { force: true } ).length > 0;
186
+ return del( filePath );
178
187
  },
179
188
  /**
180
189
  * Remove all cache stored in the cache directory
@@ -183,6 +192,6 @@ module.exports = {
183
192
  */
184
193
  clearAll: function ( cacheDir ) {
185
194
  var filePath = cacheDir ? path.resolve( cacheDir ) : path.resolve( __dirname, './.cache/' );
186
- return del( filePath, { force: true } ).length > 0;
195
+ return del( filePath );
187
196
  }
188
197
  };
package/changelog.md CHANGED
@@ -1,8 +1,75 @@
1
1
 
2
2
  # flat-cache - Changelog
3
+ ## v1.3.4
4
+ - **Refactoring**
5
+ - Add del.js and utils.js to the list of files to be beautified - [9d0ca9b]( https://github.com/royriojas/flat-cache/commit/9d0ca9b ), [Roy Riojas](https://github.com/Roy Riojas), 14/11/2018 12:19:02
6
+
7
+
8
+ ## v1.3.3
9
+ - **Refactoring**
10
+ - Make sure package-lock.json is up to date - [a7d2598]( https://github.com/royriojas/flat-cache/commit/a7d2598 ), [Roy Riojas](https://github.com/Roy Riojas), 14/11/2018 11:36:08
11
+
12
+
13
+ - **Other changes**
14
+ - Removed the need for del ([#33](https://github.com/royriojas/flat-cache/issues/33)) - [c429012]( https://github.com/royriojas/flat-cache/commit/c429012 ), [S. Gilroy](https://github.com/S. Gilroy), 13/11/2018 13:56:37
15
+
16
+ * Removed the need for del
17
+
18
+ Removed the need for del as newer versions have broken backwards
19
+ compatibility. del mainly uses rimraf for deleting folders
20
+ and files, replaceing it with rimraf only is a minimal change.
21
+
22
+ * Disable glob on rimraf calls
23
+
24
+ * Added glob disable to wrong call
25
+
26
+ * Wrapped rimraf to simplify solution
27
+
28
+ ## v1.3.2
29
+ - **Refactoring**
30
+ - remove yarn.lock file - [704c6c4]( https://github.com/royriojas/flat-cache/commit/704c6c4 ), [Roy Riojas](https://github.com/Roy Riojas), 07/11/2018 15:41:08
31
+
32
+
33
+ - **undefined**
34
+ - replace circular-json with flatted ([#23](https://github.com/royriojas/flat-cache/issues/23))" - [db12d74]( https://github.com/royriojas/flat-cache/commit/db12d74 ), [Roy Riojas](https://github.com/Roy Riojas), 07/11/2018 15:40:39
35
+
36
+ This reverts commit 00f689277a75e85fef28e6a048fad227afc525e6.
37
+
38
+ ## v1.3.1
39
+ - **Refactoring**
40
+ - upgrade deps to remove some security warnings - [f405719]( https://github.com/royriojas/flat-cache/commit/f405719 ), [Roy Riojas](https://github.com/Roy Riojas), 06/11/2018 12:07:31
41
+
42
+
43
+ - **Bug Fixes**
44
+ - replace circular-json with flatted ([#23](https://github.com/royriojas/flat-cache/issues/23)) - [00f6892]( https://github.com/royriojas/flat-cache/commit/00f6892 ), [Terry](https://github.com/Terry), 05/11/2018 18:44:16
45
+
46
+
47
+ - **undefined**
48
+ - update del to v3.0.0 ([#26](https://github.com/royriojas/flat-cache/issues/26)) - [d42883f]( https://github.com/royriojas/flat-cache/commit/d42883f ), [Patrick Silva](https://github.com/Patrick Silva), 03/11/2018 01:00:44
49
+
50
+ Closes <a target="_blank" class="info-link" href="https://github.com/royriojas/flat-cache/issues/25"><span>#25</span></a>
51
+ ## v1.3.0
52
+ - **Other changes**
53
+ - Added #all method ([#16](https://github.com/royriojas/flat-cache/issues/16)) - [12293be]( https://github.com/royriojas/flat-cache/commit/12293be ), [Ozair Patel](https://github.com/Ozair Patel), 25/09/2017 14:46:38
54
+
55
+ * Added #all method
56
+
57
+ * Added #all method test
58
+
59
+ * Updated readme
60
+
61
+ * Added yarn.lock
62
+
63
+ * Added more keys for #all test
64
+
65
+ * Beautified file
66
+
67
+ - fix changelog title style ([#14](https://github.com/royriojas/flat-cache/issues/14)) - [af8338a]( https://github.com/royriojas/flat-cache/commit/af8338a ), [前端小武](https://github.com/前端小武), 19/12/2016 20:34:48
68
+
69
+
3
70
  ## v1.2.2
4
71
  - **Bug Fixes**
5
- - Do not crash if cache file is invalid JSON. ([#13](https://github.com/royriojas/flat-cache/issues/13)) - [87beaa6]( https://github.com/royriojas/flat-cache/commit/87beaa6 ), [Roy Riojas](https://github.com/Roy Riojas), 19/12/2016 21:03:35
72
+ - Do not crash if cache file is invalid JSON. ([#13](https://github.com/royriojas/flat-cache/issues/13)) - [87beaa6]( https://github.com/royriojas/flat-cache/commit/87beaa6 ), [Roy Riojas](https://github.com/Roy Riojas), 19/12/2016 18:03:35
6
73
 
7
74
  Fixes <a target="_blank" class="info-link" href="https://github.com/royriojas/flat-cache/issues/12"><span>#12</span></a>
8
75
 
@@ -13,124 +80,186 @@
13
80
  If the cache is somehow not valid the cache will be discarded an a
14
81
  a new cache will be stored instead
15
82
  - **Other changes**
16
- - Added travis ci support for modern node versions ([#11](https://github.com/royriojas/flat-cache/issues/11)) - [1c2b1f7]( https://github.com/royriojas/flat-cache/commit/1c2b1f7 ), [Amila Welihinda](https://github.com/Amila Welihinda), 11/11/2016 02:47:52
83
+ - Added travis ci support for modern node versions ([#11](https://github.com/royriojas/flat-cache/issues/11)) - [1c2b1f7]( https://github.com/royriojas/flat-cache/commit/1c2b1f7 ), [Amila Welihinda](https://github.com/Amila Welihinda), 10/11/2016 23:47:52
17
84
 
18
85
 
19
- - Bumping `circular-son` version ([#10](https://github.com/royriojas/flat-cache/issues/10)) - [4d5e861]( https://github.com/royriojas/flat-cache/commit/4d5e861 ), [Andrea Giammarchi](https://github.com/Andrea Giammarchi), 02/08/2016 09:13:52
86
+ - Bumping `circular-son` version ([#10](https://github.com/royriojas/flat-cache/issues/10)) - [4d5e861]( https://github.com/royriojas/flat-cache/commit/4d5e861 ), [Andrea Giammarchi](https://github.com/Andrea Giammarchi), 02/08/2016 07:13:52
20
87
 
21
88
  As mentioned in https://github.com/WebReflection/circular-json/issues/25 `circular-json` wan't rightly implementing the license field.
22
89
 
23
90
  Latest version bump changed only that bit so that ESLint should now be happy.
24
91
  ## v1.2.1
25
92
  - **Bug Fixes**
26
- - Add missing utils.js file to the package. closes [#8](https://github.com/royriojas/flat-cache/issues/8) - [ec10cf2]( https://github.com/royriojas/flat-cache/commit/ec10cf2 ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 04:18:57
93
+ - Add missing utils.js file to the package. closes [#8](https://github.com/royriojas/flat-cache/issues/8) - [ec10cf2]( https://github.com/royriojas/flat-cache/commit/ec10cf2 ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 02:18:57
27
94
 
28
95
 
29
96
  ## v1.2.0
30
97
  - **Documentation**
31
- - Add documentation about noPrune option - [23e11f9]( https://github.com/royriojas/flat-cache/commit/23e11f9 ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 04:06:49
98
+ - Add documentation about noPrune option - [23e11f9]( https://github.com/royriojas/flat-cache/commit/23e11f9 ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 02:06:49
32
99
 
33
100
 
34
- ## v1.0.11
101
+ ## v1.1.0
35
102
  - **Features**
36
- - Add noPrune option to cache.save() method. closes [#7](https://github.com/royriojas/flat-cache/issues/7) - [2c8016a]( https://github.com/royriojas/flat-cache/commit/2c8016a ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 04:00:29
103
+ - Add noPrune option to cache.save() method. closes [#7](https://github.com/royriojas/flat-cache/issues/7) - [2c8016a]( https://github.com/royriojas/flat-cache/commit/2c8016a ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 02:00:29
37
104
 
38
105
 
39
- - Add json read and write utility based on circular-json - [c31081e]( https://github.com/royriojas/flat-cache/commit/c31081e ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 10:58:17
106
+ - Add json read and write utility based on circular-json - [c31081e]( https://github.com/royriojas/flat-cache/commit/c31081e ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:58:17
40
107
 
41
108
 
42
109
  - **Bug Fixes**
43
- - Remove UTF16 BOM stripping - [4a41e22]( https://github.com/royriojas/flat-cache/commit/4a41e22 ), [Jean Ponchon](https://github.com/Jean Ponchon), 29/07/2016 04:18:06
110
+ - Remove UTF16 BOM stripping - [4a41e22]( https://github.com/royriojas/flat-cache/commit/4a41e22 ), [Jean Ponchon](https://github.com/Jean Ponchon), 29/07/2016 02:18:06
44
111
 
45
112
  Since we control both writing and reading of JSON stream, there no needs
46
113
  to handle unicode BOM.
47
- - Use circular-json to handle circular references (fix [#5](https://github.com/royriojas/flat-cache/issues/5)) - [cd7aeed]( https://github.com/royriojas/flat-cache/commit/cd7aeed ), [Jean Ponchon](https://github.com/Jean Ponchon), 25/07/2016 13:11:59
114
+ - Use circular-json to handle circular references (fix [#5](https://github.com/royriojas/flat-cache/issues/5)) - [cd7aeed]( https://github.com/royriojas/flat-cache/commit/cd7aeed ), [Jean Ponchon](https://github.com/Jean Ponchon), 25/07/2016 11:11:59
48
115
 
49
116
 
50
117
  - **Tests Related fixes**
51
- - Add missing file from eslint test - [d6fa3c3]( https://github.com/royriojas/flat-cache/commit/d6fa3c3 ), [Jean Ponchon](https://github.com/Jean Ponchon), 29/07/2016 04:15:51
118
+ - Add missing file from eslint test - [d6fa3c3]( https://github.com/royriojas/flat-cache/commit/d6fa3c3 ), [Jean Ponchon](https://github.com/Jean Ponchon), 29/07/2016 02:15:51
52
119
 
53
120
 
54
- - Add test for circular json serialization / deserialization - [07d2ddd]( https://github.com/royriojas/flat-cache/commit/07d2ddd ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 10:59:36
121
+ - Add test for circular json serialization / deserialization - [07d2ddd]( https://github.com/royriojas/flat-cache/commit/07d2ddd ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:59:36
55
122
 
56
123
 
57
124
  - **Refactoring**
58
- - Remove unused read-json-sync - [2be1c24]( https://github.com/royriojas/flat-cache/commit/2be1c24 ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 10:59:18
125
+ - Remove unused read-json-sync - [2be1c24]( https://github.com/royriojas/flat-cache/commit/2be1c24 ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:59:18
59
126
 
60
127
 
61
128
  - **Build Scripts Changes**
62
- - travis tests on 0.12 and 4x - [3a613fd]( https://github.com/royriojas/flat-cache/commit/3a613fd ), [royriojas](https://github.com/royriojas), 15/11/2015 17:34:40
129
+ - travis tests on 0.12 and 4x - [3a613fd]( https://github.com/royriojas/flat-cache/commit/3a613fd ), [royriojas](https://github.com/royriojas), 15/11/2015 14:34:40
63
130
 
64
131
 
65
- ## v1.0.10
66
- - **Build Scripts Changes**
67
- - add eslint-fix task - [fd29e52]( https://github.com/royriojas/flat-cache/commit/fd29e52 ), [royriojas](https://github.com/royriojas), 01/11/2015 18:04:08
132
+ - add eslint-fix task - [fd29e52]( https://github.com/royriojas/flat-cache/commit/fd29e52 ), [royriojas](https://github.com/royriojas), 01/11/2015 15:04:08
68
133
 
69
134
 
70
- - make sure the test script also verify beautification and linting of files before running tests - [e94e176]( https://github.com/royriojas/flat-cache/commit/e94e176 ), [royriojas](https://github.com/royriojas), 01/11/2015 14:54:48
135
+ - make sure the test script also verify beautification and linting of files before running tests - [e94e176]( https://github.com/royriojas/flat-cache/commit/e94e176 ), [royriojas](https://github.com/royriojas), 01/11/2015 11:54:48
71
136
 
72
137
 
73
138
  - **Other changes**
74
- - add clearAll for cacheDir - [97383d9]( https://github.com/royriojas/flat-cache/commit/97383d9 ), [xieyaowu](https://github.com/xieyaowu), 31/10/2015 23:02:18
139
+ - add clearAll for cacheDir - [97383d9]( https://github.com/royriojas/flat-cache/commit/97383d9 ), [xieyaowu](https://github.com/xieyaowu), 31/10/2015 21:02:18
75
140
 
76
141
 
77
142
  ## v1.0.9
78
143
  - **Bug Fixes**
79
- - wrong default values for changelogx user repo name - [7bb52d1]( https://github.com/royriojas/flat-cache/commit/7bb52d1 ), [royriojas](https://github.com/royriojas), 11/09/2015 17:59:30
144
+ - wrong default values for changelogx user repo name - [7bb52d1]( https://github.com/royriojas/flat-cache/commit/7bb52d1 ), [royriojas](https://github.com/royriojas), 11/09/2015 15:59:30
80
145
 
81
146
 
82
147
  ## v1.0.8
83
148
  - **Build Scripts Changes**
84
- - test against node 4 - [c395b66]( https://github.com/royriojas/flat-cache/commit/c395b66 ), [royriojas](https://github.com/royriojas), 11/09/2015 17:51:39
149
+ - test against node 4 - [c395b66]( https://github.com/royriojas/flat-cache/commit/c395b66 ), [royriojas](https://github.com/royriojas), 11/09/2015 15:51:39
85
150
 
86
151
 
87
152
  ## v1.0.7
88
153
  - **Other changes**
89
- - Move dependencies into devDep - [7e47099]( https://github.com/royriojas/flat-cache/commit/7e47099 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 17:10:57
154
+ - Move dependencies into devDep - [7e47099]( https://github.com/royriojas/flat-cache/commit/7e47099 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 15:10:57
90
155
 
91
156
 
92
157
  - **Documentation**
93
- - Add missing changelog link - [f51197a]( https://github.com/royriojas/flat-cache/commit/f51197a ), [royriojas](https://github.com/royriojas), 11/09/2015 16:48:05
158
+ - Add missing changelog link - [f51197a]( https://github.com/royriojas/flat-cache/commit/f51197a ), [royriojas](https://github.com/royriojas), 11/09/2015 14:48:05
94
159
 
95
160
 
96
161
  ## v1.0.6
97
162
  - **Build Scripts Changes**
98
- - Add helpers/code check scripts - [bdb82f3]( https://github.com/royriojas/flat-cache/commit/bdb82f3 ), [royriojas](https://github.com/royriojas), 11/09/2015 16:44:31
163
+ - Add helpers/code check scripts - [bdb82f3]( https://github.com/royriojas/flat-cache/commit/bdb82f3 ), [royriojas](https://github.com/royriojas), 11/09/2015 14:44:31
99
164
 
100
165
 
101
166
  ## v1.0.5
102
167
  - **Documentation**
103
- - better description for the module - [436817f]( https://github.com/royriojas/flat-cache/commit/436817f ), [royriojas](https://github.com/royriojas), 11/09/2015 16:35:33
168
+ - better description for the module - [436817f]( https://github.com/royriojas/flat-cache/commit/436817f ), [royriojas](https://github.com/royriojas), 11/09/2015 14:35:33
104
169
 
105
170
 
106
171
  - **Other changes**
107
- - Update dependencies - [be88aa3]( https://github.com/royriojas/flat-cache/commit/be88aa3 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 15:47:41
172
+ - Update dependencies - [be88aa3]( https://github.com/royriojas/flat-cache/commit/be88aa3 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 13:47:41
173
+
174
+
175
+ ## v1.0.11
176
+ - **Features**
177
+ - Add noPrune option to cache.save() method. closes [#7](https://github.com/royriojas/flat-cache/issues/7) - [2c8016a]( https://github.com/royriojas/flat-cache/commit/2c8016a ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 02:00:29
178
+
179
+
180
+ - Add json read and write utility based on circular-json - [c31081e]( https://github.com/royriojas/flat-cache/commit/c31081e ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:58:17
181
+
182
+
183
+ - **Bug Fixes**
184
+ - Remove UTF16 BOM stripping - [4a41e22]( https://github.com/royriojas/flat-cache/commit/4a41e22 ), [Jean Ponchon](https://github.com/Jean Ponchon), 29/07/2016 02:18:06
185
+
186
+ Since we control both writing and reading of JSON stream, there no needs
187
+ to handle unicode BOM.
188
+ - Use circular-json to handle circular references (fix [#5](https://github.com/royriojas/flat-cache/issues/5)) - [cd7aeed]( https://github.com/royriojas/flat-cache/commit/cd7aeed ), [Jean Ponchon](https://github.com/Jean Ponchon), 25/07/2016 11:11:59
189
+
190
+
191
+ - **Tests Related fixes**
192
+ - Add missing file from eslint test - [d6fa3c3]( https://github.com/royriojas/flat-cache/commit/d6fa3c3 ), [Jean Ponchon](https://github.com/Jean Ponchon), 29/07/2016 02:15:51
193
+
194
+
195
+ - Add test for circular json serialization / deserialization - [07d2ddd]( https://github.com/royriojas/flat-cache/commit/07d2ddd ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:59:36
108
196
 
109
197
 
110
- ## v1.0.4
111
198
  - **Refactoring**
112
- - load a cache file using the full filepath - [b8f68c2]( https://github.com/royriojas/flat-cache/commit/b8f68c2 ), [Roy Riojas](https://github.com/Roy Riojas), 30/08/2015 06:19:14
199
+ - Remove unused read-json-sync - [2be1c24]( https://github.com/royriojas/flat-cache/commit/2be1c24 ), [Jean Ponchon](https://github.com/Jean Ponchon), 28/07/2016 08:59:18
200
+
201
+
202
+ - **Build Scripts Changes**
203
+ - travis tests on 0.12 and 4x - [3a613fd]( https://github.com/royriojas/flat-cache/commit/3a613fd ), [royriojas](https://github.com/royriojas), 15/11/2015 14:34:40
204
+
205
+
206
+ ## v1.0.10
207
+ - **Build Scripts Changes**
208
+ - add eslint-fix task - [fd29e52]( https://github.com/royriojas/flat-cache/commit/fd29e52 ), [royriojas](https://github.com/royriojas), 01/11/2015 15:04:08
209
+
210
+
211
+ - make sure the test script also verify beautification and linting of files before running tests - [e94e176]( https://github.com/royriojas/flat-cache/commit/e94e176 ), [royriojas](https://github.com/royriojas), 01/11/2015 11:54:48
212
+
213
+
214
+ - test against node 4 - [c395b66]( https://github.com/royriojas/flat-cache/commit/c395b66 ), [royriojas](https://github.com/royriojas), 11/09/2015 15:51:39
215
+
216
+
217
+ - Add helpers/code check scripts - [bdb82f3]( https://github.com/royriojas/flat-cache/commit/bdb82f3 ), [royriojas](https://github.com/royriojas), 11/09/2015 14:44:31
218
+
219
+
220
+ - **Other changes**
221
+ - add clearAll for cacheDir - [97383d9]( https://github.com/royriojas/flat-cache/commit/97383d9 ), [xieyaowu](https://github.com/xieyaowu), 31/10/2015 21:02:18
222
+
223
+
224
+ - Move dependencies into devDep - [7e47099]( https://github.com/royriojas/flat-cache/commit/7e47099 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 15:10:57
225
+
226
+
227
+ - Update dependencies - [be88aa3]( https://github.com/royriojas/flat-cache/commit/be88aa3 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 13:47:41
228
+
229
+
230
+ - **Bug Fixes**
231
+ - wrong default values for changelogx user repo name - [7bb52d1]( https://github.com/royriojas/flat-cache/commit/7bb52d1 ), [royriojas](https://github.com/royriojas), 11/09/2015 15:59:30
113
232
 
114
233
 
115
234
  - **Documentation**
116
- - Add documentation about `clearAll` and `clearCacheById` - [13947c1]( https://github.com/royriojas/flat-cache/commit/13947c1 ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 02:44:05
235
+ - Add missing changelog link - [f51197a]( https://github.com/royriojas/flat-cache/commit/f51197a ), [royriojas](https://github.com/royriojas), 11/09/2015 14:48:05
236
+
237
+
238
+ - better description for the module - [436817f]( https://github.com/royriojas/flat-cache/commit/436817f ), [royriojas](https://github.com/royriojas), 11/09/2015 14:35:33
239
+
240
+
241
+ - Add documentation about `clearAll` and `clearCacheById` - [13947c1]( https://github.com/royriojas/flat-cache/commit/13947c1 ), [Roy Riojas](https://github.com/Roy Riojas), 01/03/2015 23:44:05
242
+
243
+
244
+ - **Refactoring**
245
+ - load a cache file using the full filepath - [b8f68c2]( https://github.com/royriojas/flat-cache/commit/b8f68c2 ), [Roy Riojas](https://github.com/Roy Riojas), 30/08/2015 04:19:14
117
246
 
118
247
 
119
248
  - **Features**
120
- - Add methods to remove the cache documents created - [af40443]( https://github.com/royriojas/flat-cache/commit/af40443 ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 02:39:27
249
+ - Add methods to remove the cache documents created - [af40443]( https://github.com/royriojas/flat-cache/commit/af40443 ), [Roy Riojas](https://github.com/Roy Riojas), 01/03/2015 23:39:27
121
250
 
122
251
 
123
252
  ## v1.0.1
124
253
  - **Other changes**
125
- - Update README.md - [c2b6805]( https://github.com/royriojas/flat-cache/commit/c2b6805 ), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 07:28:07
254
+ - Update README.md - [c2b6805]( https://github.com/royriojas/flat-cache/commit/c2b6805 ), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 04:28:07
126
255
 
127
256
 
128
257
  ## v1.0.0
129
258
  - **Refactoring**
130
- - flat-cache v.1.0.0 - [c984274]( https://github.com/royriojas/flat-cache/commit/c984274 ), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 07:11:50
259
+ - flat-cache v.1.0.0 - [c984274]( https://github.com/royriojas/flat-cache/commit/c984274 ), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 04:11:50
131
260
 
132
261
 
133
262
  - **Other changes**
134
- - Initial commit - [d43cccf]( https://github.com/royriojas/flat-cache/commit/d43cccf ), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 04:12:16
263
+ - Initial commit - [d43cccf]( https://github.com/royriojas/flat-cache/commit/d43cccf ), [Roy Riojas](https://github.com/Roy Riojas), 26/02/2015 01:12:16
135
264
 
136
265
 
package/del.js ADDED
@@ -0,0 +1,13 @@
1
+ var rimraf = require( 'rimraf' ).sync;
2
+ var fs = require( 'graceful-fs' );
3
+
4
+ module.exports = function del( file ) {
5
+ if ( fs.existsSync( file ) ) {
6
+ //if rimraf doesn't throw then the file has been deleted or didn't exist
7
+ rimraf( file, {
8
+ glob: false
9
+ } );
10
+ return true;
11
+ }
12
+ return false;
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flat-cache",
3
- "version": "1.2.2",
3
+ "version": "1.3.4",
4
4
  "description": "A stupidly simple key/value storage using files to persist some data",
5
5
  "repository": "royriojas/flat-cache",
6
6
  "license": "MIT",
@@ -11,7 +11,8 @@
11
11
  "main": "cache.js",
12
12
  "files": [
13
13
  "cache.js",
14
- "utils.js"
14
+ "utils.js",
15
+ "del.js"
15
16
  ],
16
17
  "engines": {
17
18
  "node": ">=0.10.0"
@@ -23,9 +24,9 @@
23
24
  "npm run verify --silent"
24
25
  ],
25
26
  "scripts": {
26
- "beautify": "esbeautifier 'cache.js' 'test/specs/**/*.js'",
27
+ "beautify": "esbeautifier 'cache.js' 'utils.js' 'del.js' 'test/specs/**/*.js'",
27
28
  "beautify-check": "npm run beautify -- -k",
28
- "eslint": "eslinter 'cache.js' 'utils.js' 'specs/**/*.js'",
29
+ "eslint": "eslinter 'cache.js' 'utils.js' 'del.js' 'specs/**/*.js'",
29
30
  "eslint-fix": "npm run eslint -- --fix",
30
31
  "autofix": "npm run beautify && npm run eslint-fix",
31
32
  "check": "npm run beautify-check && npm run eslint",
@@ -65,12 +66,12 @@
65
66
  },
66
67
  "devDependencies": {
67
68
  "chai": "^3.2.0",
68
- "changelogx": "^1.0.18",
69
- "esbeautifier": "^6.1.8",
69
+ "changelogx": "3.0.0",
70
+ "esbeautifier": "10.1.1",
70
71
  "eslinter": "^3.2.1",
71
- "glob-expand": "^0.1.0",
72
- "istanbul": "^0.3.19",
73
- "mocha": "^2.3.2",
72
+ "glob-expand": "0.2.1",
73
+ "istanbul": "0.4.5",
74
+ "mocha": "5.2.0",
74
75
  "precommit": "^1.1.5",
75
76
  "prepush": "^3.1.4",
76
77
  "proxyquire": "^1.7.2",
@@ -80,8 +81,8 @@
80
81
  },
81
82
  "dependencies": {
82
83
  "circular-json": "^0.3.1",
83
- "del": "^2.0.2",
84
84
  "graceful-fs": "^4.1.2",
85
+ "rimraf": "~2.6.2",
85
86
  "write": "^0.2.1"
86
87
  }
87
88
  }
package/utils.js CHANGED
@@ -4,7 +4,7 @@ var circularJson = require( 'circular-json' );
4
4
 
5
5
  module.exports = {
6
6
 
7
- tryParse: function ( filePath, defaultValue) {
7
+ tryParse: function ( filePath, defaultValue ) {
8
8
  var result;
9
9
  try {
10
10
  result = this.readJSON( filePath );
@@ -32,7 +32,7 @@ module.exports = {
32
32
  * @param {String} filePath Json filepath
33
33
  * @param {*} data Object to serialize
34
34
  */
35
- writeJSON: function (filePath, data ) {
35
+ writeJSON: function ( filePath, data ) {
36
36
  write.sync( filePath, circularJson.stringify( data ) );
37
37
  }
38
38