@javien/mikro-orm-redis-cache-adapter
Advanced tools
Comparing version 0.0.10 to 0.1.0
{ | ||
"name": "@javien/mikro-orm-redis-cache-adapter", | ||
"description": "mikro-orm redis cache adapter using v8 serialize", | ||
"version": "0.0.10", | ||
"version": "0.1.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "author": "Javien Lee <kraccoon@dimipay.io> (https://github.com/SnowMarble/)", |
@@ -28,3 +28,4 @@ # Mikro ORM Redis Cache Adapter | ||
logger: myLogger, | ||
// (optional) gracefulShutdown: If you want to close the Redis connection by yourself, set it to `false`. Defaults to `true`. | ||
// (optional) gracefulShutdown: If you want to close the Redis connection by yourself, | ||
// set it to `false`. Defaults to `true`. | ||
gracefulShutdown: false | ||
@@ -74,18 +75,13 @@ } as RedisCacheAdapterOptions | ||
const obj = {} | ||
obj.obj = obj | ||
JSON.stringify(obj) | ||
// Uncaught TypeError: Converting circular structure to JSON | ||
// --> starting at object with constructor 'Object' | ||
// --- property 'obj' closes the circle | ||
JSON.stringify(new Date()) // '"2024-05-26T05:39:00.493Z"' | ||
// serializes to string, so parsed result is different from original | ||
const buf = Buffer.from([0]) | ||
const str = JSON.stringify(buf) | ||
// '{"type":"Buffer","data":[0]}' | ||
const parsed = JSON.parse(str) | ||
// { type: 'Buffer', data: [ 0 ] } | ||
// parsed value is different with original data. | ||
const str = JSON.stringify(buf) //'{"type":"Buffer","data":[0]}' | ||
// Buffer.toJSON method is called, so parsed result is different from original | ||
``` | ||
To solve this, we can pass the [`replacer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter) parameter. However, I don't think this is the best way to serialize data, while we can choose v8 api. | ||
To solve this, we can pass the [`replacer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter) parameter. | ||
So you might think using `JSON.stringify` with `replacer` is fine. | ||
However, I don't think this is the best way to serialize data, while we can choose v8 api. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
11487
86