<commit_before># frozen_string_literal: true

class Pawoo::Sitemap
  attr_reader :page

  SITEMAPINDEX_SIZE = 10_000

  def self.page_count
    (paging_class.maximum(:id) / SITEMAPINDEX_SIZE) + 1
  end

  def initialize(page)
    @page = page
  end

  private

  def min_id
    (page.to_i - 1) * SITEMAPINDEX_SIZE
  end

  def max_id
    min_id + SITEMAPINDEX_SIZE
  end

  def redis_key
    "pawoo:sitemap:#{self.class::REDIS_KEY}:#{page}"
  end

  def read_from_cache
    Rails.cache.read(redis_key)
  end

  def store_to_cache(ids)
    Rails.cache.write(redis_key, ids, expired_in: 2.days)
  end

end<commit_msg>Fix expires_in<commit_after># frozen_string_literal: true

class Pawoo::Sitemap
  attr_reader :page

  SITEMAPINDEX_SIZE = 10_000

  def self.page_count
    (paging_class.maximum(:id) / SITEMAPINDEX_SIZE) + 1
  end

  def initialize(page)
    @page = page
  end

  private

  def min_id
    (page.to_i - 1) * SITEMAPINDEX_SIZE
  end

  def max_id
    min_id + SITEMAPINDEX_SIZE
  end

  def redis_key
    "pawoo:sitemap:#{self.class::REDIS_KEY}:#{page}"
  end

  def read_from_cache
    Rails.cache.read(redis_key)
  end

  def store_to_cache(ids)
    Rails.cache.write(redis_key, ids, expires_in: 2.days)
  end

end
{'fraction_non_alphanumeric': 0.09098294069861901, 'fraction_numerical': 0.012997562956945572, 'mean_word_length': 3.431654676258993, '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': '6171385', 'n_tokens_mistral': 531, 'n_tokens_neox': 495, 'n_words': 96}