Skip to content

Commit 1913338

Browse files
authored
minor: Reduce default cache size to 10_000 items (#836)
- Currently it's set to 60k items which is a bit too aggressive for most users, which results in extra memory consumption. - Align default size setting with README Co-authored-by: Dmitry Shirokov <dshirokov@atlassian.com>
1 parent 41c1751 commit 1913338

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ coverage
66
npm-debug.log
77
.nyc_output
88
lib
9+
.vscode

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2023 Dmitry Shirokov
3+
Copyright (c) 2024 Dmitry Shirokov
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ _maxmind.open(filepath, [options])_
6565
- `filepath`: `<string>` Path to the binary mmdb database file.
6666
- `options`: `<Object>`
6767
- `cache`: `<Object>` Cache options. Under the bonnet module uses [tiny-lru](https://github.com/avoidwork/tiny-lru) cache.
68-
- `max`: `<number>` Max cache items to keep in memory. _Default_: `6000`.
68+
- `max`: `<number>` Max cache items to keep in memory. _Default_: `10_000`.
6969
- `watchForUpdates`: `<boolean>` Supports reloading the reader when changes occur to the database that is loaded. _Default_: `false`.
70-
- `watchForUpdatesNonPersistent`: `<boolean>` Controlls wether the watcher should be persistent or not. If it is persistent, a node process will be blocked in watching state if the watcher is the only thing still running in the program. _Default_: `false`.
70+
- `watchForUpdatesNonPersistent`: `<boolean>` Controls whether the watcher should be persistent or not. If it is persistent, a node process will be blocked in watching state if the watcher is the only thing still running in the program. _Default_: `false`.
7171
- `watchForUpdatesHook`: `<Function>` Hook function that is fired on database update. _Default_: `null`.
7272

7373
## Does it work in browser?

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const open = async <T extends Response>(
3232
);
3333
}
3434

35-
const cache = lru(opts?.cache?.max || 60000);
35+
const cache = lru(opts?.cache?.max || 10_000);
3636
const reader = new Reader<T>(database, { cache });
3737

3838
if (opts && !!opts.watchForUpdates) {

0 commit comments

Comments
 (0)