Browse Source

Adds caching

Lou 2 years ago
parent
commit
203c9c6696
2 changed files with 4 additions and 0 deletions
  1. 2
    0
      app/serializers/activity_serializer.rb
  2. 2
    0
      app/serializers/user_serializer.rb

+ 2
- 0
app/serializers/activity_serializer.rb View File

@@ -1,4 +1,6 @@
1 1
 class ActivitySerializer
2 2
   include JSONAPI::Serializer
3 3
   attributes :name, :author_id, :description, :client
4
+
5
+  cache_options store: Rails.cache, namespace: 'jsonapi-serializer', expires_in: 1.hour
4 6
 end

+ 2
- 0
app/serializers/user_serializer.rb View File

@@ -2,4 +2,6 @@ class UserSerializer
2 2
   include JSONAPI::Serializer
3 3
   attributes :email, :username
4 4
   has_many :activities
5
+
6
+  cache_options store: Rails.cache, namespace: 'jsonapi-serializer', expires_in: 1.hour
5 7
 end

Loading…
Cancel
Save