From bb0734f8f335dbef0c4d2ff035e38f4dd85978bd Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Mon, 5 Oct 2015 11:46:48 +0200 Subject: [PATCH] cache requests --- lib/resources/user.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/resources/user.rb b/lib/resources/user.rb index 50721df3e..a761471ae 100644 --- a/lib/resources/user.rb +++ b/lib/resources/user.rb @@ -147,15 +147,18 @@ class User < Vulcano.resource(1) private def identiy - @user_provider.identity(@user) if !@user_provider.nil? + return @id_cache if !@id_cache.nil? + @id_cache = @user_provider.identity(@user) if !@user_provider.nil? end def meta_info - @user_provider.meta_info(@user) if !@user_provider.nil? + return @meta_cache if !@meta_cache.nil? + @meta_cache = @user_provider.meta_info(@user) if !@user_provider.nil? end def credentials - @user_provider.credentials(@user) if !@user_provider.nil? + return @cred_cache if !@cred_cache.nil? + @cred_cache = @user_provider.credentials(@user) if !@user_provider.nil? end end