Skip to content

Commit

Permalink
fix: swap lru-native to a lru-cache library (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
sckv committed Jul 24, 2022
1 parent c40653e commit ba8ef4a
Show file tree
Hide file tree
Showing 6 changed files with 614 additions and 472 deletions.
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -39,8 +39,8 @@
"devDependencies": {
"@types/lodash": "^4.14.178",
"axios": "^0.26.0",
"barehttp": "^0.4.2",
"code-concierge": "^1.0.4",
"barehttp": "^0.5.0",
"code-concierge": "^1.1.0",
"typedoc": "^0.22.13",
"typedoc-plugin-markdown": "^3.11.14"
},
Expand All @@ -49,7 +49,7 @@
"hyperid": "^3.0.0",
"io-ts": "^2.2.16",
"lodash": "^4.17.21",
"lru-native2": "^1.2.5",
"lru-cache": "^7.13.1",
"reflect-metadata": "^0.1.13"
}
}
}
4 changes: 2 additions & 2 deletions src/engine/__tests__/bus-contex.test.ts
Expand Up @@ -4,9 +4,9 @@ import axios from 'axios';

import { TypedBus } from '../instance';

const app = new BareHttp();
const app = new BareHttp({ serverPort: 3000 });

app.get({
app.route.get({
route: '/route',
handler: async (flex) => {
const hookResponse = await TypedBus.publish(
Expand Down
1 change: 0 additions & 1 deletion src/engine/instance.ts
@@ -1,4 +1,3 @@
import { TypedBusClass } from './typed-bus';

export { context } from '../context/context';
export const TypedBus = new TypedBusClass();
4 changes: 2 additions & 2 deletions src/engine/transport.ts
@@ -1,4 +1,4 @@
import LRUCache from 'lru-native2';
import LRUCache from 'lru-cache';
import * as iots from 'io-ts';
import { isLeft } from 'fp-ts/lib/Either';

Expand All @@ -19,7 +19,7 @@ export type PublishedConsumer = {
exec: any;
};

const cache = new LRUCache({ maxLoadFactor: 2, size: 10000, maxAge: 10000 });
const cache = new LRUCache({ max: 10000, ttl: 10000 });

export abstract class Transport {
abstract name: string;
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
@@ -1,5 +1,5 @@
export { Event } from './engine/event';
export { TypedBus, context } from './engine/instance';
export { TypedBus } from './engine/instance';
export { Transport, ConsumerMethod } from './engine/transport';
export { DumpController } from './engine/dump-controller';
export { Consume } from './decorators/consume';

0 comments on commit ba8ef4a

Please sign in to comment.