<commit_before>(ns org.spootnik.cyanite.store_cache
  "Caching facility for Cyanite"
  (:require [clojure.string :as str]
            [clojure.tools.logging :refer [error info debug]]
            [org.spootnik.cyanite.store :as store]
            [org.spootnik.cyanite.util :refer [agg-fn-by-path]]))

(defprotocol StoreCache
  (put! [this tenant period rollup time path data ttl fn-agg fn-store])
  (flush! [this])
  (-show-keys [this])
  (-show-cache [this])
  (-show-meta [this]))

(def ^:const metric-wait-time 60)
(def ^:const cache-add-ttl 180)

(defn- construct-mkey
  [tenant period rollup time]
  (str/join "-" [tenant period rollup time]))

(defn- construct-key
  ([tenant period rollup time path]
     (str/join "-" [(construct-mkey tenant period rollup time) path]))
  ([mkey path]
     (str/join "-" [mkey path])))

(defn- calc-delay
  [rollup add]
  (+ rollup metric-wait-time add))

(defn- to-ms
  [sec]
  (* sec 1000))

(defn- create-flusher
  [mkeys mkey pkeys tenant period rollup time ttl fn-get fn-agg fn-store fn-key]
  (fn []<commit_msg>Remove obsolete def<commit_after>(ns org.spootnik.cyanite.store_cache
  "Caching facility for Cyanite"
  (:require [clojure.string :as str]
            [clojure.tools.logging :refer [error info debug]]
            [org.spootnik.cyanite.store :as store]
            [org.spootnik.cyanite.util :refer [agg-fn-by-path]]))

(defprotocol StoreCache
  (put! [this tenant period rollup time path data ttl fn-agg fn-store])
  (flush! [this])
  (-show-keys [this])
  (-show-cache [this])
  (-show-meta [this]))

(def ^:const metric-wait-time 60)

(defn- construct-mkey
  [tenant period rollup time]
  (str/join "-" [tenant period rollup time]))

(defn- construct-key
  ([tenant period rollup time path]
     (str/join "-" [(construct-mkey tenant period rollup time) path]))
  ([mkey path]
     (str/join "-" [mkey path])))

(defn- calc-delay
  [rollup add]
  (+ rollup metric-wait-time add))

(defn- to-ms
  [sec]
  (* sec 1000))

(defn- create-flusher
  [mkeys mkey pkeys tenant period rollup time ttl fn-get fn-agg fn-store fn-key]
  (fn []
{'fraction_non_alphanumeric': 0.15200764818355642, 'fraction_numerical': 0.007170172084130019, 'mean_word_length': 3.228282828282828, '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': '1873507', 'n_tokens_mistral': 789, 'n_tokens_neox': 776, 'n_words': 212}