<commit_before># Two Buckets Memcache

Memcache that trades a simplified expiry strategy for a super low resource consumption

[![Build Status](https://travis-ci.org/analog-nico/two-buckets-memcache.svg?branch=master)](https://travis-ci.org/analog-nico/two-buckets-memcache) [![Coverage Status](https://coveralls.io/repos/request/two-buckets-memcache/badge.svg?branch=master&service=github)](https://coveralls.io/github/request/two-buckets-memcache?branch=master) [![Dependency Status](https://david-dm.org/analog-nico/two-buckets-memcache.svg)](https://david-dm.org/analog-nico/two-buckets-memcache)

## Installation

[![NPM Stats](https://nodei.co/npm/two-buckets-memcache.png?downloads=true)](https://npmjs.org/package/two-buckets-memcache)

This is a module for node.js and is installed via npm:

``` bash
npm install two-buckets-memcache --save
```

## What is special about this memory cache?

![Schematic](img/two-buckets-memcache.png)

The milliseconds you pass to the constructor define how soon the cache moves to a new bucket. The newest bucket is always the one in which new entries are stored. After the given milliseconds this bucket gets retired and is only used to get old cache entries. The second time the given milliseconds elapse, the retired bucket gets deleted and the old cache entries it contains expire with it. As a result a stored cache entry expires after 1x to 2x the given milliseconds, i.e. 10-20 seconds.

This design allows a super low resource consumption:

- Just a single timer is used, instead of one timer for each cache entry like many other memcaches do.<commit_msg>Fixed Coveralls badge again<commit_after># Two Buckets Memcache

Memcache that trades a simplified expiry strategy for a super low resource consumption

[![Build Status](https://travis-ci.org/analog-nico/two-buckets-memcache.svg?branch=master)](https://travis-ci.org/analog-nico/two-buckets-memcache) [![Coverage Status](https://coveralls.io/repos/analog-nico/two-buckets-memcache/badge.svg?branch=master&service=github)](https://coveralls.io/github/analog-nico/two-buckets-memcache?branch=master) [![Dependency Status](https://david-dm.org/analog-nico/two-buckets-memcache.svg)](https://david-dm.org/analog-nico/two-buckets-memcache)

## Installation

[![NPM Stats](https://nodei.co/npm/two-buckets-memcache.png?downloads=true)](https://npmjs.org/package/two-buckets-memcache)

This is a module for node.js and is installed via npm:

``` bash
npm install two-buckets-memcache --save
```

## What is special about this memory cache?

![Schematic](img/two-buckets-memcache.png)

The milliseconds you pass to the constructor define how soon the cache moves to a new bucket. The newest bucket is always the one in which new entries are stored. After the given milliseconds this bucket gets retired and is only used to get old cache entries. The second time the given milliseconds elapse, the retired bucket gets deleted and the old cache entries it contains expire with it. As a result a stored cache entry expires after 1x to 2x the given milliseconds, i.e. 10-20 seconds.

This design allows a super low resource consumption:

- Just a single timer is used, instead of one timer for each cache entry like many other memcaches do.
{'fraction_non_alphanumeric': 0.10513296227581942, 'fraction_numerical': 0.0037105751391465678, 'mean_word_length': 4.946691176470588, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5022697', 'n_tokens_mistral': 1003, 'n_tokens_neox': 939, 'n_words': 330}