<commit_before>Impromptu = require '../impromptu'

class Instance extends Impromptu.Cache
  run: (fn) ->
    return get fn if @_cached

    @set (err, results) =>
      if err then fn err else @get fn


  get: (fn) ->
    fn null, @_cached ? @options.fallback


  set: (fn) ->
    @options.update.call @options.context, (err, value) =>
      unless err
        @_cached = value
      fn err, !err<commit_msg>Add missing reference to this.<commit_after>Impromptu = require '../impromptu'

class Instance extends Impromptu.Cache
  run: (fn) ->
    return @get fn if @_cached

    @set (err, results) =>
      if err then fn err else @get fn


  get: (fn) ->
    fn null, @_cached ? @options.fallback


  set: (fn) ->
    @options.update.call @options.context, (err, value) =>
      unless err
        @_cached = value
      fn err, !err
{'fraction_non_alphanumeric': 0.12949640287769784, 'fraction_numerical': 0.0, 'mean_word_length': 2.508403361344538, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '6115783', 'n_tokens_mistral': 288, 'n_tokens_neox': 279, 'n_words': 91}