Skip to content

Commit

Permalink
chore: Export AbstractAssignmentCache (#87)
Browse files Browse the repository at this point in the history
* chore: Export AbstractAssignmentCache

* bump version
  • Loading branch information
felipecsl committed Jun 13, 2024
1 parent cbd2015 commit 6265238
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eppo/js-client-sdk-common",
"version": "3.2.2",
"version": "3.3.0",
"description": "Eppo SDK for client-side JavaScript applications (base for both web and react native)",
"main": "dist/index.js",
"files": [
Expand Down
8 changes: 5 additions & 3 deletions src/cache/assignment-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface AssignmentCache {
has(key: AssignmentCacheKey): boolean;
}

export abstract class AssignmentCacheImpl<T extends Map<string, string>>
export abstract class AbstractAssignmentCache<T extends Map<string, string>>
implements AssignmentCache
{
// key -> variation value hash
Expand Down Expand Up @@ -59,7 +59,9 @@ export abstract class AssignmentCacheImpl<T extends Map<string, string>>
* The primary use case is for client-side SDKs, where the cache is only used
* for a single user.
*/
export class NonExpiringInMemoryAssignmentCache extends AssignmentCacheImpl<Map<string, string>> {
export class NonExpiringInMemoryAssignmentCache extends AbstractAssignmentCache<
Map<string, string>
> {
constructor() {
super(new Map<string, string>());
}
Expand All @@ -74,7 +76,7 @@ export class NonExpiringInMemoryAssignmentCache extends AssignmentCacheImpl<Map<
* multiple users. In this case, the cache size should be set to the maximum number
* of users that can be active at the same time.
*/
export class LRUInMemoryAssignmentCache extends AssignmentCacheImpl<LRUCache> {
export class LRUInMemoryAssignmentCache extends AbstractAssignmentCache<LRUCache> {
constructor(maxSize: number) {
super(new LRUCache(maxSize));
}
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { logger } from './application-logger';
import { IAssignmentHooks } from './assignment-hooks';
import { IAssignmentLogger, IAssignmentEvent } from './assignment-logger';
import {
AbstractAssignmentCache,
AssignmentCache,
NonExpiringInMemoryAssignmentCache,
LRUInMemoryAssignmentCache,
Expand All @@ -24,6 +25,7 @@ import * as validation from './validation';

export {
logger as applicationLogger,
AbstractAssignmentCache,
IAssignmentHooks,
IAssignmentLogger,
IAssignmentEvent,
Expand Down

0 comments on commit 6265238

Please sign in to comment.