<commit_before>require 'asakusa_satellite/hook'
module ApplicationHelper
  include AsakusaSatellite::Hook::Helper

  def logged?
    not current_user.nil?
  end

  def current_user
    @cached_current_user =
      @cached_current_user || User.where(:_id => session[:current_user_id]).first
  end

  def set_current_user(user)
    session[:current_user_id] = user.id
  end

  def image_mimetype?(mimetype)
    mimetype =~ /^image\//
  end
end<commit_msg>cache in session refs #760<commit_after>require 'asakusa_satellite/hook'
module ApplicationHelper
  include AsakusaSatellite::Hook::Helper

  def logged?
    not current_user.nil?
  end

  def current_user
    if session[:cached_current_user].nil?
      session[:cached_current_user] = User.where(:_id => session[:current_user_id]).first
    end
    session[:cached_current_user]
  end

  def set_current_user(user)
    session[:current_user_id] = user.id
  end

  def image_mimetype?(mimetype)
    mimetype =~ /^image\//
  end
end
{'fraction_non_alphanumeric': 0.09959349593495935, 'fraction_numerical': 0.003048780487804878, 'mean_word_length': 4.23936170212766, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4648023', 'n_tokens_mistral': 348, 'n_tokens_neox': 331, 'n_words': 64}