Module: Card::Cache::All

Included in:
Card
Defined in:
card/lib/card/cache/all.rb

Overview

cache-related instance methods available to all Cards

Instance Method Summary collapse

Instance Method Details

#ensure_view_cache_key(cache_key) ⇒ Object



30
31
32
33
34
35
# File 'card/lib/card/cache/all.rb', line 30

def ensure_view_cache_key cache_key
  return if view_cache_keys.include? cache_key

  view_cache_keys << cache_key
  shared_write_view_cache_keys
end

#expire(cache_type = nil) ⇒ Object



17
18
19
20
21
22
23
24
# File 'card/lib/card/cache/all.rb', line 17

def expire cache_type=nil
  return unless (cache_class = cache_class_from_type cache_type)

  expire_views
  expire_names cache_class
  expire_id cache_class
  expire_left cache_type
end

#lexObject



9
10
11
12
13
14
15
# File 'card/lib/card/cache/all.rb', line 9

def lex
  if simple?
    name
  elsif left_id && right_id
    [left_id, right_id]
  end
end

#view_cache_clean?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'card/lib/card/cache/all.rb', line 26

def view_cache_clean?
  !db_content_changed?
end

#write_lexiconObject



5
6
7
# File 'card/lib/card/cache/all.rb', line 5

def write_lexicon
  Lexicon.write_to_temp_cache id, name, lex
end