Skip to content

Commit 51ef954

Browse files
Gargronhiyuki2578
authored andcommitted
Add cache to custom emojis API (mastodon#9732)
Fix mastodon#9729
1 parent 5d7b921 commit 51ef954

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

app/controllers/api/v1/custom_emojis_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ class Api::V1::CustomEmojisController < Api::BaseController
44
respond_to :json
55

66
def index
7-
render json: CustomEmoji.local.where(disabled: false), each_serializer: REST::CustomEmojiSerializer
7+
render_cached_json('api:v1:custom_emojis', expires_in: 1.minute) do
8+
ActiveModelSerializers::SerializableResource.new(CustomEmoji.local.where(disabled: false), each_serializer: REST::CustomEmojiSerializer)
9+
end
810
end
911
end

0 commit comments

Comments
 (0)