CacheBridge.php 975 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace WeWork\Laravel;
  3. use Illuminate\Support\Facades\Cache;
  4. use Psr\SimpleCache\CacheInterface;
  5. class CacheBridge implements CacheInterface
  6. {
  7. public function get($key, $default = null)
  8. {
  9. return Cache::get($key, $default);
  10. }
  11. public function set($key, $value, $ttl = null)
  12. {
  13. Cache::put($key, $value, $this->toMinutes($ttl));
  14. }
  15. public function delete($key)
  16. {
  17. //
  18. }
  19. public function clear()
  20. {
  21. //
  22. }
  23. public function getMultiple($keys, $default = null)
  24. {
  25. //
  26. }
  27. public function setMultiple($values, $ttl = null)
  28. {
  29. //
  30. }
  31. public function deleteMultiple($keys)
  32. {
  33. //
  34. }
  35. public function has($key)
  36. {
  37. return Cache::has($key);
  38. }
  39. protected function toMinutes($ttl = null)
  40. {
  41. if (!is_null($ttl)) {
  42. return $ttl / 60;
  43. }
  44. }
  45. }