<commit_before># frozen_string_literal: true

class RedirectCache

  # 4 redirect/hr 24hrs a day for 7 days
  PERSIST_AFTER = 4 * 24 * 7

  attr_reader :redirects

  def initialize(redirects: nil, feed_url: nil)
    @redirects = redirects
    @feed_url = feed_url
  end

  def self.save(redirects, feed_url:)
    new(redirects: redirects, feed_url: feed_url).save
  end

  def self.read(feed_url)
    new(feed_url: feed_url).read
  end

  def self.delete(feed_url)
    new(feed_url: feed_url).delete
  end

  def save
    Cache.write(stable_key, {to: @redirects.last.to}) if redirect_stable?
  end<commit_msg>Lower redirect save threshold.<commit_after># frozen_string_literal: true

class RedirectCache

  # 4 redirect/hr 24hrs a day for 6 days
  PERSIST_AFTER = 4 * 24 * 6

  attr_reader :redirects

  def initialize(redirects: nil, feed_url: nil)
    @redirects = redirects
    @feed_url = feed_url
  end

  def self.save(redirects, feed_url:)
    new(redirects: redirects, feed_url: feed_url).save
  end

  def self.read(feed_url)
    new(feed_url: feed_url).read
  end

  def self.delete(feed_url)
    new(feed_url: feed_url).delete
  end

  def save
    Cache.write(stable_key, {to: @redirects.last.to}) if redirect_stable?
  end
{'fraction_non_alphanumeric': 0.09149797570850203, 'fraction_numerical': 0.012955465587044534, 'mean_word_length': 3.735632183908046, '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': '195864', 'n_tokens_mistral': 474, 'n_tokens_neox': 441, 'n_words': 112}