<commit_before>'use strict';

var cache = require("memory-cache");
const objectAssign = require('object-assign');

module.exports = function(options){
	var globalOptions = objectAssign({
		time		: 1000*60*5,// default time of 5 minutes
		autoUpdate	: false,	// should update automaticaly after expire
		debug		: false		// enable debug
	}, options);

	return {
		get : function(key, generator, callback, options){
			if(!isNaN(parseFloat(options))){
				options = {
					time : options
				}
			}
			options = objectAssign(globalOptions, options);
			var time = time || options.defaultTime;

			var args = cache.get(key);
			if(args === null){
				if(options.debug){
					console.log("Cache: "+key+" - Getting data, next time in "+options.time);
				}
				if(generator instanceof Function){
					var cacher = function(){
						cache.put(key, arguments, options.time);
						callback.apply(null, arguments);
					}
					generator(cacher);
				}
			}else{
				if(options.debug){
					console.log("Cache: "+key+" - Using cached data");
				}
				if(callback instanceof Function){
					callback.apply(null, args);<commit_msg>removes unused variable<commit_after>'use strict';

var cache = require("memory-cache");
const objectAssign = require('object-assign');

module.exports = function(options){
	var globalOptions = objectAssign({
		time		: 1000*60*5,// default time of 5 minutes
		autoUpdate	: false,	// should update automaticaly after expire
		debug		: false		// enable debug
	}, options);

	return {
		get : function(key, generator, callback, options){
			if(!isNaN(parseFloat(options))){
				options = {
					time : options
				}
			}
			options = objectAssign(globalOptions, options);

			var args = cache.get(key);
			if(args === null){
				if(options.debug){
					console.log("Cache: "+key+" - Getting data, next time in "+options.time);
				}
				if(generator instanceof Function){
					var cacher = function(){
						cache.put(key, arguments, options.time);
						callback.apply(null, arguments);
					}
					generator(cacher);
				}
			}else{
				if(options.debug){
					console.log("Cache: "+key+" - Using cached data");
				}
				if(callback instanceof Function){
					callback.apply(null, args);
{'fraction_non_alphanumeric': 0.14091526959673764, 'fraction_numerical': 0.007249660172179429, 'mean_word_length': 3.320939334637965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7067388', 'n_tokens_mistral': 838, 'n_tokens_neox': 655, 'n_words': 171}