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

clickhouse-ts

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clickhouse-ts - npm Package Compare versions

Comparing version 1.3.6 to 1.3.7

17

dist/src/caching/RedisCacheManager.js

@@ -16,3 +16,3 @@ "use strict";

};
var _RedisCacheManager_tableChunks, _RedisCacheManager_instance, _RedisCacheManager_chunkResolver, _RedisCacheManager_options, _RedisCacheManager_checkChunks, _RedisCacheManager_createChunk, _RedisCacheManager_deleteChunk, _RedisCacheManager_getChunk;
var _RedisCacheManager_tableChunks, _RedisCacheManager_instance, _RedisCacheManager_chunkResolver, _RedisCacheManager_splitter, _RedisCacheManager_options, _RedisCacheManager_checkChunks, _RedisCacheManager_createChunk, _RedisCacheManager_deleteChunk, _RedisCacheManager_getChunk;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -29,2 +29,3 @@ exports.RedisCacheManager = void 0;

_RedisCacheManager_chunkResolver.set(this, void 0);
_RedisCacheManager_splitter.set(this, '&&&');
_RedisCacheManager_options.set(this, void 0);

@@ -36,3 +37,3 @@ _RedisCacheManager_checkChunks.set(this, async () => {

for (const chunkNamespace of chunkNamespaces) {
const [_chunk_, _table, _id, _strExpiresAtUnix] = chunkNamespace.split('_');
const [_chunk_, _table, _id, _strExpiresAtUnix] = chunkNamespace.split(__classPrivateFieldGet(this, _RedisCacheManager_splitter, "f"));
const expiresAt = Number(_strExpiresAtUnix);

@@ -72,3 +73,5 @@ const chunkNamespaceTTL = await __classPrivateFieldGet(this, _RedisCacheManager_instance, "f").ttl(chunkNamespace);

}
const newChunk = `chunk_${table}_${uuid_1.v4()}_${now.add(__classPrivateFieldGet(this, _RedisCacheManager_options, "f").chunkTTLSeconds, 'second').unix()}`;
const id = uuid_1.v4();
const ttl = now.add(__classPrivateFieldGet(this, _RedisCacheManager_options, "f").chunkTTLSeconds, 'second').unix();
const newChunk = ['chunk', table, id, ttl].join(__classPrivateFieldGet(this, _RedisCacheManager_splitter, "f"));
__classPrivateFieldGet(this, _RedisCacheManager_tableChunks, "f")[table].push(newChunk);

@@ -89,3 +92,3 @@ return newChunk;

const chunk = __classPrivateFieldGet(this, _RedisCacheManager_tableChunks, "f")[table].find(chunk => {
const [_chunk, _table, _id, strExpiresAtUnix] = chunk.split('_');
const [_chunk, _table, _id, strExpiresAtUnix] = chunk.split(__classPrivateFieldGet(this, _RedisCacheManager_splitter, "f"));
const expiresAt = Number(strExpiresAtUnix);

@@ -108,5 +111,5 @@ if (now.unix() < expiresAt) {

__classPrivateFieldSet(this, _RedisCacheManager_instance, instance, "f");
const cachedChunkTables = await __classPrivateFieldGet(this, _RedisCacheManager_instance, "f").keys('chunk_*');
const cachedChunkTables = await __classPrivateFieldGet(this, _RedisCacheManager_instance, "f").keys(`chunk${__classPrivateFieldGet(this, _RedisCacheManager_splitter, "f")}*`);
for await (const chunkTable of cachedChunkTables) {
const [_, table] = chunkTable.split('_');
const [_, table] = chunkTable.split(__classPrivateFieldGet(this, _RedisCacheManager_splitter, "f"));
if (!__classPrivateFieldGet(this, _RedisCacheManager_tableChunks, "f")[table]) {

@@ -127,2 +130,2 @@ __classPrivateFieldGet(this, _RedisCacheManager_tableChunks, "f")[table] = [];

exports.RedisCacheManager = RedisCacheManager;
_RedisCacheManager_tableChunks = new WeakMap(), _RedisCacheManager_instance = new WeakMap(), _RedisCacheManager_chunkResolver = new WeakMap(), _RedisCacheManager_options = new WeakMap(), _RedisCacheManager_checkChunks = new WeakMap(), _RedisCacheManager_createChunk = new WeakMap(), _RedisCacheManager_deleteChunk = new WeakMap(), _RedisCacheManager_getChunk = new WeakMap();
_RedisCacheManager_tableChunks = new WeakMap(), _RedisCacheManager_instance = new WeakMap(), _RedisCacheManager_chunkResolver = new WeakMap(), _RedisCacheManager_splitter = new WeakMap(), _RedisCacheManager_options = new WeakMap(), _RedisCacheManager_checkChunks = new WeakMap(), _RedisCacheManager_createChunk = new WeakMap(), _RedisCacheManager_deleteChunk = new WeakMap(), _RedisCacheManager_getChunk = new WeakMap();

@@ -12,3 +12,3 @@ {

],
"version": "1.3.6",
"version": "1.3.7",
"license": "MIT",

@@ -15,0 +15,0 @@ "description": "Clickhouse client on TypeScript using nodejs ot redis caching queries",

@@ -10,2 +10,3 @@ import dayjs from "dayjs";

#chunkResolver?: NodeJS.Timeout
readonly #splitter = '&&&'
#options: {

@@ -37,3 +38,3 @@ chunkTTLSeconds: number;

for (const chunkNamespace of chunkNamespaces) {
const [_chunk_, _table, _id, _strExpiresAtUnix] = chunkNamespace.split('_')
const [_chunk_, _table, _id, _strExpiresAtUnix] = chunkNamespace.split(this.#splitter)
const expiresAt = Number(_strExpiresAtUnix)

@@ -81,4 +82,7 @@

const newChunk = `chunk_${table}_${uuidv4()}_${now.add(this.#options.chunkTTLSeconds, 'second').unix()}`
const id = uuidv4()
const ttl = now.add(this.#options.chunkTTLSeconds, 'second').unix()
const newChunk = ['chunk', table, id, ttl].join(this.#splitter)
this.#tableChunks[table].push(newChunk)

@@ -104,3 +108,3 @@

const chunk = this.#tableChunks[table].find(chunk => {
const [_chunk, _table, _id, strExpiresAtUnix] = chunk.split('_')
const [_chunk, _table, _id, strExpiresAtUnix] = chunk.split(this.#splitter)
const expiresAt = Number(strExpiresAtUnix)

@@ -122,6 +126,6 @@

this.#instance = instance
const cachedChunkTables = await this.#instance.keys('chunk_*')
const cachedChunkTables = await this.#instance.keys(`chunk${this.#splitter}*`)
for await (const chunkTable of cachedChunkTables) {
const [_, table] = chunkTable.split('_')
const [_, table] = chunkTable.split(this.#splitter)

@@ -128,0 +132,0 @@ if (!this.#tableChunks[table]) {

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