[redis] Example change to redis pooling code.

This commit is contained in:
Fosco Marotto 2021-01-16 13:36:19 -05:00
parent c9da516af6
commit 8b0f566e4f
1 changed files with 6 additions and 2 deletions

View File

@ -1,10 +1,14 @@
class Admin::ExpensesController < Admin::BaseController class Admin::ExpensesController < Admin::BaseController
def index def index
@amount = Redis.current.get("monthly_funding_amount") || 0 Redis.current.with do |conn|
@amount = conn.get("monthly_funding_amount") || 0
end
end end
def create def create
Redis.current.set("monthly_funding_amount", params[:amount]) Redis.current.with do |conn|
conn.set("monthly_funding_amount", params[:amount])
end
redirect_to admin_expenses_path redirect_to admin_expenses_path
end end