Class: Jekyll::WebmentionIO::Caches
- Inherits:
-
Object
- Object
- Jekyll::WebmentionIO::Caches
- Defined in:
- lib/jekyll/caches.rb
Overview
The Caches class is a utility service that provides access to the cache files used by this plugin.
It is initialized with a config object and creates a folder in the configured cache folder to store the cache files.
The class is a singleton and the instance is accessed via the WebmentionIO.caches method.
Class Method Summary collapse
-
.reset ⇒ Object
Resets all singleton cache instances by clearing the class variables.
Instance Method Summary collapse
- #bad_uris ⇒ Object
- #incoming_webmentions ⇒ Object
-
#initialize(config) ⇒ Caches
constructor
A new instance of Caches.
- #outgoing_webmentions ⇒ Object
- #site_lookups ⇒ Object
Constructor Details
#initialize(config) ⇒ Caches
Returns a new instance of Caches.
16 17 18 19 20 |
# File 'lib/jekyll/caches.rb', line 16 def initialize(config) @config = config FileUtils.makedirs(@config.cache_folder) end |
Class Method Details
.reset ⇒ Object
Resets all singleton cache instances by clearing the class variables. This is useful for testing to ensure clean state between tests.
40 41 42 43 44 45 |
# File 'lib/jekyll/caches.rb', line 40 def self.reset @@incoming_webmentions = nil @@outgoing_webmentions = nil @@bad_uris = nil @@site_lookups = nil end |
Instance Method Details
#bad_uris ⇒ Object
30 31 32 |
# File 'lib/jekyll/caches.rb', line 30 def bad_uris @@bad_uris ||= Cache.new(cache_file_path('bad_uris')) end |
#incoming_webmentions ⇒ Object
22 23 24 |
# File 'lib/jekyll/caches.rb', line 22 def incoming_webmentions @@incoming_webmentions ||= Cache.new(cache_file_path('incoming')) end |
#outgoing_webmentions ⇒ Object
26 27 28 |
# File 'lib/jekyll/caches.rb', line 26 def outgoing_webmentions @@outgoing_webmentions ||= Cache.new(cache_file_path('outgoing')) end |
#site_lookups ⇒ Object
34 35 36 |
# File 'lib/jekyll/caches.rb', line 34 def site_lookups @@site_lookups ||= Cache.new(cache_file_path('lookups')) end |