• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / bibdata / 373ad6ff-fad2-405a-ab26-3d30fb5ceecf

24 Dec 2024 08:24PM UTC coverage: 91.938% (+0.08%) from 91.859%
373ad6ff-fad2-405a-ab26-3d30fb5ceecf

Pull #2563

circleci

maxkadel
Put attaching xml files in their own batch
Pull Request #2563: I2321 Shift SCSB full index tasks into separate background jobs

152 of 156 new or added lines in 10 files covered. (97.44%)

65 existing lines in 17 files now uncovered.

3478 of 3783 relevant lines covered (91.94%)

366.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.21
/marc_to_solr/lib/cache_manager.rb
1
require 'active_support/core_ext/module'
1✔
2

3
# Class for handling instances of caching objects
4
class CacheManager
1✔
5
  # Build and set the current cache to the new instance
6
  # @param cache [ActiveSupport::Cache::Store, CacheAdapter] Low-level cache
7
  # @param logger [IO] logger for handling output during HTTP service requests
8
  def self.initialize(figgy_cache:, logger: STDOUT)
1✔
9
    @current_cache = new(figgy_cache:, logger:)
3✔
10
  end
11

12
  # Retrieve the last initialized cache manager
13
  # Raises an error if a cache hasn't been initialized
14
  # @return [CacheManager]
15
  def self.current
1✔
16
    @current_cache
3✔
17
  rescue
18
    raise NotImplementedError, 'Please initialize a cache using CacheManager.initialize(cache: Rails.cache, logger: Rails.logger)'
×
19
  end
20

21
  # Clear a cache directory by removing its contents
22
  # @param dir [String] path to the cache directory
23
  def self.clear(dir:)
1✔
24
    return unless Dir.exist? dir
×
UNCOV
25
    FileUtils.rm_r Dir.glob("#{dir}/*")
×
26
  end
27

28
  # Constructor
29
  # @param cache [ActiveSupport::Cache::Store] Rails low-level cache
30
  # @param logger [IO] logger for handling output during HTTP service requests
31
  def initialize(figgy_cache:, logger: STDOUT)
1✔
32
    @figgy_cache = figgy_cache
3✔
33
    @logger = logger
3✔
34

35
    # Seed the caches
36
    seed!
3✔
37
  end
38

39
  # Retrieve the stored (or seed) the cache for the ARK's in Figgy
40
  # @return [CacheMap]
41
  def figgy_ark_cache
1✔
42
    @figgy_ark_cache ||= CacheMap.new(cache: @figgy_cache, host: "figgy.princeton.edu", logger: @logger)
23✔
43
  end
44

45
  # Retrieve the stored (or seed) the cache for the ARK's in all repositories
46
  # @return [CompositeCacheMap]
47
  def ark_cache
1✔
48
    @cache_maps ||= CompositeCacheMap.new(cache_maps: [figgy_ark_cache])
17✔
49
  end
50

51
  # Ensure the the CacheMap and CompositeCacheMap instances are memoized
52
  delegate :seed!, to: :figgy_ark_cache
1✔
53
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc