Skip to content

Commit

Permalink
override cache conf
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed Sep 24, 2024
1 parent 373a40a commit 5689c09
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/helpers/concerns/view_model_override.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module ViewModelOverride
extend ActiveSupport::Concern

included do
private

def perform_caching?
Decidim::Env.new("DISABLE_CACHE").blank? && cache_hash.present?
end

def cache_expiry_time
Decidim::Env.new("CACHE_EXPIRY_TIME").presence&.to_i || 1.hour
end
end
end
3 changes: 3 additions & 0 deletions config/initializers/overrides.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Rails.application.config.to_prepare do
Decidim::ViewModel.include(ViewModelOverride)
end

0 comments on commit 5689c09

Please sign in to comment.