1.0.7 โ€ข Published 11 months ago

@rbxts/muon v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

npm version GitHub license

โš›๏ธ Muon

Muon is a simple memory store library implementation designed with ease of use in mind. It features exponential backoff for every operation in Hash Maps, Queues, and Sorted Maps

๐Ÿ“ฆ Installation

To install Muon, use npm:

npm install @rbxts/muon

๐Ÿงช Usage

import { Muon } from '@rbxts/muon';

const hashMap = Muon.hashMap('myHashMap', {
	lifetime: 60, // data only exists for 60 seconds
	exponentialBackoff = {
		base: 1.5; // if something fails, it will retry for 1.5 (1.5^1), then 2.25 (1.5^2), ..., and so on till maxTries has been reached
		maxTries: 5; // a maximum of 5 tries before it gives an error
	}
});

(async() => {
	await hashMap.set('count', 1);
	await hashMap.update('count', (oldCount) => ++oldCount); // increments the count. has a side effect of resetting the lifetime of the count

	print(await hashMap.get<number>('count'));
})();

Any operation method has an overrideOptions parameter, which allows you to specify what options should be used for the operation

// ...
await hashMap.set('count', 1, { lifetime: 120 }); // use a lifetime of 120 seconds

๐Ÿค Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

๐Ÿ“„ License

Muon is licensed under the MIT License. See the LICENSE file for more details.

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

1 year ago