Skip to content

Instantly share code, notes, and snippets.

@s4l1h
Created October 16, 2016 14:38
Show Gist options
  • Save s4l1h/4e9c36ee4ca430f7ad0b7062b4f7f109 to your computer and use it in GitHub Desktop.
Save s4l1h/4e9c36ee4ca430f7ad0b7062b4f7f109 to your computer and use it in GitHub Desktop.
/*
GetirOnu fonksiyonu gördüğünüz gibi ilk parametre olarak cache key alıyor
fakat ikinci parametre MemoryCache olmalı.
Redis yada memcache'e uyarlamak istediğinizde projedeki tüm MemoryCache yazan satırları değişmeniz gerekir
GetirOnu fonksiyonunu sadece MemoryCache ile çalışıyor.
*/
func GetirOnu(key string,cache *MemoryCache) (string,error]){
value, err := cache.Get(key)
if err != nil {
fmt.Println("Hata Oluştu : ", err)
return "",error
}
return string(value),nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment