<commit_before>/**
 *
 * Abstract i/o-Operations
 * Mostly just a wrapper to localstorage
 *
 *
 * @class data
 */
var data = (function(){
	"use strict";

	var cache = {},

	/**
	 * Get Item
	 * 
	 * @memberof data
	 * @method get
	 * @param {String} key
	 * @return {String} value
	 */
	get = function(key){
		return typeof cache[key] !== "undefined" ? cache[key] : localStorage.getItem(key);
	},

	/**
	 * Set (Save) Item
	 * 
	 * @memberof data
	 * @method set
	 * @param {String} key
	 * @param {String} value
	 * @return {Boolean} success
	 */
	set = function(key, value){
		cache[key] = value;
		return localStorage.setItem(key, value);
	},
<commit_msg>cache values from localstorage on first request, and speed up subsequent requests<commit_after>/**
 *
 * Abstract i/o-Operations
 * Mostly just a wrapper to localstorage
 *
 * @TODO: write benchmarks for cache
 * @class data
 */
var data = (function(){
	"use strict";

	/** 
	 * since localstorage is quite slow, values get cached 
	 */
	var cache = {},

	/**
	 * Get Item
	 * 
	 * @memberof data
	 * @method get
	 * @param {String} key
	 * @return {String} value
	 */
	get = function(key){
		if( typeof cache[key] === "undefined" ) {
			cache[key] = localStorage.getItem(key);
		}
		return cache[key];
	},

	/**
	 * Set (Save) Item
	 * 
	 * @memberof data
	 * @method set
	 * @param {String} key
	 * @param {String} value
	 * @return {Boolean} success
	 */
	set = function(key, value){
		cache[key] = value;
		return localStorage.setItem(key, value);
	},

{'fraction_non_alphanumeric': 0.15577557755775578, 'fraction_numerical': 0.0, 'mean_word_length': 3.053475935828877, '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': '6914062', 'n_tokens_mistral': 544, 'n_tokens_neox': 492, 'n_words': 150}