Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@javien/mikro-orm-redis-cache-adapter

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@javien/mikro-orm-redis-cache-adapter - npm Package Compare versions

Comparing version 0.0.10 to 0.1.0

2

package.json
{
"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.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc