Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/resources/application_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ class ApplicationResource < Graphiti::Resource
self.endpoint_namespace = '/api/v3/public'
self.autolink = true
link(:self) { |resource| "#{endpoint[:url]}/#{resource.id}" } if endpoint[:actions].include?(:show)
# Cache things for a week. Cache keys will update when entities are updated.
self.cache_resource expires_in: 1.week # rubocop:disable Style/RedundantSelf
end
3 changes: 3 additions & 0 deletions config/initializers/graphiti.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# frozen_string_literal: true

Graphiti.cache = ::Rails.cache

Graphiti.configure do |config|
config.cache_rendering = true
config.pagination_links = true
end