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

sofa-hessian-node

Package Overview
Dependencies
Maintainers
4
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sofa-hessian-node - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

6

History.md
2.1.0 / 2020-07-01
==================
**features**
* [[`bd303c7`](http://github.com/sofastack/sofa-hessian-node/commit/bd303c74f4d23def37936a8f617747f5344b53a7)] - feat: every classMap will has own compileCache (#30) (陈峰 <<348018533@qq.com>>)
2.0.0 / 2020-06-16

@@ -3,0 +9,0 @@ ==================

23

lib/v3/compile.js

@@ -9,2 +9,3 @@ 'use strict';

const codegen = require('@protobufjs/codegen');
const classMapCacheOn = Symbol('classMapCacheOn');

@@ -125,4 +126,20 @@ let cache = new Map();

/**
* special key to determine the map structure logic
* @param {Map<string, object>} classMap class data required for compile
*/
function getCompileCache(classMap) {
if (!cache.get(classMapCacheOn)) {
return cache;
}
// If there is a special key, the cache uses the classmap dimension to establish a secondary cache structure. Different classmaps use different caches
if (!cache.has(classMap)) {
cache.set(classMap, new Map());
}
return cache.get(classMap);
}
function compile(uniqueId, info, classMap, version, options) {
let encodeFn = cache.get(uniqueId);
const compileCache = getCompileCache(classMap);
let encodeFn = compileCache.get(uniqueId);
if (encodeFn) return encodeFn;

@@ -255,3 +272,3 @@

}
cache.set(uniqueId, encodeFn);
compileCache.set(uniqueId, encodeFn);
return encodeFn;

@@ -269,1 +286,3 @@ }

};
module.exports.classMapCacheOn = classMapCacheOn;

@@ -9,2 +9,3 @@ 'use strict';

const codegen = require('@protobufjs/codegen');
const classMapCacheOn = Symbol('classMapCacheOn');

@@ -124,4 +125,20 @@ let cache = new Map();

/**
* special key to determine the map structure logic
* @param {Map<string, object>} classMap class data required for compile
*/
function getCompileCache(classMap) {
if (!cache.get(classMapCacheOn)) {
return cache;
}
// If there is a special key, the cache uses the classmap dimension to establish a secondary cache structure. Different classmaps use different caches
if (!cache.has(classMap)) {
cache.set(classMap, new Map());
}
return cache.get(classMap);
}
function compile(uniqueId, info, classMap, version, options) {
let encodeFn = cache.get(uniqueId);
const compileCache = getCompileCache(classMap);
let encodeFn = compileCache.get(uniqueId);
if (encodeFn) return encodeFn;

@@ -250,3 +267,3 @@

}
cache.set(uniqueId, encodeFn);
compileCache.set(uniqueId, encodeFn);
return encodeFn;

@@ -262,1 +279,3 @@ }

};
module.exports.classMapCacheOn = classMapCacheOn;

2

package.json
{
"name": "sofa-hessian-node",
"version": "2.0.0",
"version": "2.1.0",
"description": "An internal improved version of Hessian powered by Ant Financial.",

@@ -5,0 +5,0 @@ "main": "index.js",

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