apc.php 785 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php namespace System\Session;
  2. use System\Cache;
  3. class APC implements Driver {
  4. /**
  5. * Load a session by ID.
  6. *
  7. * @param string $id
  8. * @return array
  9. */
  10. public function load($id)
  11. {
  12. return Cache::driver('apc')->get($id);
  13. }
  14. /**
  15. * Save a session.
  16. *
  17. * @param array $session
  18. * @return void
  19. */
  20. public function save($session)
  21. {
  22. Cache::driver('apc')->put($session['id'], $session, Config::get('session.lifetime'));
  23. }
  24. /**
  25. * Delete a session by ID.
  26. *
  27. * @param string $id
  28. * @return void
  29. */
  30. public function delete($id)
  31. {
  32. Cache::driver('apc')->forget($id);
  33. }
  34. /**
  35. * Delete all expired sessions.
  36. *
  37. * @param int $expiration
  38. * @return void
  39. */
  40. public function sweep($expiration)
  41. {
  42. // APC sessions will expire automatically.
  43. }
  44. }