Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace lru-cache package with simple local implementation (FF-1876) #47

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

leoromanovsky
Copy link
Member

@leoromanovsky leoromanovsky commented Apr 5, 2024


labels: mergeable

Fixes: #issue

Motivation and Context

A customer is unable to upgrade eppo's latest js sdk versions.

ERROR in ./node_modules/@eppo/js-client-sdk-common/node_modules/lru-cache/dist/commonjs/index.js 27:15
Module parse failed: Unexpected token (27:15)

The lru-cache package appears to be incompatible for some reason.

Description

Replaces the package with a simple local implementation. Are needs do not require generic types, just a Map<string, string> suffices.

How has this been tested?

New unit test for LRUCache class.

@leoromanovsky leoromanovsky force-pushed the lr/ff-1876/lru-cache branch from 20b7543 to 0a8abda Compare April 5, 2024 04:41
Copy link
Contributor

@aarsilv aarsilv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done!

@@ -0,0 +1,64 @@
import { LRUCache } from './lru-cache';

describe('LRUCache', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

Comment on lines +30 to +34
// the delete and set operations are used together to ensure that the most recently accessed
// or added item is always considered the "newest" in terms of access order.
// This is crucial for maintaining the correct order of elements in the cache,
// which directly impacts which item is considered the least recently used (LRU) and
// thus eligible for eviction when the cache reaches its capacity.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@leoromanovsky leoromanovsky merged commit 0861538 into main Apr 5, 2024
2 checks passed
@leoromanovsky leoromanovsky deleted the lr/ff-1876/lru-cache branch April 5, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants