|
6 | 6 | [npm]: https://www.npmjs.com/package/@plgworks/cache |
7 | 7 |
|
8 | 8 | Cache is the central cache implementation for several modules. |
9 | | - |
10 | 9 | It contains three caching engines. The decision of which caching engine to use is governed while creating the cache object. |
11 | 10 | The caching engines implemented are: |
12 | 11 |
|
13 | | -* Memcached |
14 | | -* Redis |
15 | | -* In-process (use with single threaded process in development mode only) |
| 12 | +* [Memcached](https://memcached.org/) |
| 13 | +* [Redis](https://redis.io/docs/) |
| 14 | +* In-memory (use with single threaded process in development mode only) |
| 15 | + |
| 16 | +# Install NPM |
| 17 | +```bash |
| 18 | +npm install @plgworks/cache --save |
| 19 | +``` |
16 | 20 |
|
17 | | -##### Constructor parameters: |
| 21 | +# Initialize |
18 | 22 | There is 1 parameter required while creating the cache implementer. |
19 | 23 |
|
20 | 24 | * First parameter is mandatory and it specifies the configuration strategy to be used. An example of the configStrategy is: |
@@ -67,14 +71,7 @@ configStrategy = { |
67 | 71 | consistentBehavior: "1" |
68 | 72 | } |
69 | 73 | } |
70 | | -```` |
71 | | - |
72 | | -# Install |
73 | | - |
74 | | -```bash |
75 | | -npm install @plgworks/cache --save |
76 | 74 | ``` |
77 | | - |
78 | 75 | # Examples: |
79 | 76 |
|
80 | 77 | #### Create Cache Object: |
@@ -185,3 +182,29 @@ cacheImplementer.touch('testKey', 10).then(function(cacheResponse){ |
185 | 182 | } |
186 | 183 | }); |
187 | 184 | ``` |
| 185 | +### Running test cases |
| 186 | +##### Set environment variables of particular cache engine for which you want to run the tests. |
| 187 | +```` |
| 188 | +# For Memcached |
| 189 | +source test/env/memcached.sh |
| 190 | +
|
| 191 | +# For Redis |
| 192 | +source test/env/redis.sh |
| 193 | +
|
| 194 | +# For In-memory |
| 195 | +source test/env/inMemory.sh |
| 196 | +```` |
| 197 | +##### Cache engines must be running on the specified ports. |
| 198 | + |
| 199 | +* Memcached (11212,11213,11214,11215) |
| 200 | +```` |
| 201 | +memcached -p 11212 -d |
| 202 | +```` |
| 203 | +* Redis (6380,6381) |
| 204 | +```` |
| 205 | +redis-server --port 6380 |
| 206 | +```` |
| 207 | +##### Run tests |
| 208 | +```` |
| 209 | +./node_modules/.bin/mocha --recursive "./test/*.js" |
| 210 | +```` |
0 commit comments