Skip to content

Commit 6265238

Browse files
authored
chore: Export AbstractAssignmentCache (#87)
* chore: Export AbstractAssignmentCache * bump version
1 parent cbd2015 commit 6265238

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eppo/js-client-sdk-common",
3-
"version": "3.2.2",
3+
"version": "3.3.0",
44
"description": "Eppo SDK for client-side JavaScript applications (base for both web and react native)",
55
"main": "dist/index.js",
66
"files": [

src/cache/assignment-cache.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface AssignmentCache {
2020
has(key: AssignmentCacheKey): boolean;
2121
}
2222

23-
export abstract class AssignmentCacheImpl<T extends Map<string, string>>
23+
export abstract class AbstractAssignmentCache<T extends Map<string, string>>
2424
implements AssignmentCache
2525
{
2626
// key -> variation value hash
@@ -59,7 +59,9 @@ export abstract class AssignmentCacheImpl<T extends Map<string, string>>
5959
* The primary use case is for client-side SDKs, where the cache is only used
6060
* for a single user.
6161
*/
62-
export class NonExpiringInMemoryAssignmentCache extends AssignmentCacheImpl<Map<string, string>> {
62+
export class NonExpiringInMemoryAssignmentCache extends AbstractAssignmentCache<
63+
Map<string, string>
64+
> {
6365
constructor() {
6466
super(new Map<string, string>());
6567
}
@@ -74,7 +76,7 @@ export class NonExpiringInMemoryAssignmentCache extends AssignmentCacheImpl<Map<
7476
* multiple users. In this case, the cache size should be set to the maximum number
7577
* of users that can be active at the same time.
7678
*/
77-
export class LRUInMemoryAssignmentCache extends AssignmentCacheImpl<LRUCache> {
79+
export class LRUInMemoryAssignmentCache extends AbstractAssignmentCache<LRUCache> {
7880
constructor(maxSize: number) {
7981
super(new LRUCache(maxSize));
8082
}

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { logger } from './application-logger';
22
import { IAssignmentHooks } from './assignment-hooks';
33
import { IAssignmentLogger, IAssignmentEvent } from './assignment-logger';
44
import {
5+
AbstractAssignmentCache,
56
AssignmentCache,
67
NonExpiringInMemoryAssignmentCache,
78
LRUInMemoryAssignmentCache,
@@ -24,6 +25,7 @@ import * as validation from './validation';
2425

2526
export {
2627
logger as applicationLogger,
28+
AbstractAssignmentCache,
2729
IAssignmentHooks,
2830
IAssignmentLogger,
2931
IAssignmentEvent,

0 commit comments

Comments
 (0)