CakeSessionHandlerInterface.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  10. * @link http://cakephp.org CakePHP(tm) Project
  11. * @package Cake.Model.Datasource
  12. * @since CakePHP(tm) v 2.1
  13. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  14. */
  15. /**
  16. * Interface for Session handlers. Custom session handler classes should implement
  17. * this interface as it allows CakeSession know how to map methods to session_set_save_handler()
  18. *
  19. * @package Cake.Model.Datasource.Session
  20. */
  21. interface CakeSessionHandlerInterface {
  22. /**
  23. * Method called on open of a session.
  24. *
  25. * @return boolean Success
  26. */
  27. public function open();
  28. /**
  29. * Method called on close of a session.
  30. *
  31. * @return boolean Success
  32. */
  33. public function close();
  34. /**
  35. * Method used to read from a session.
  36. *
  37. * @param string $id The key of the value to read
  38. * @return mixed The value of the key or false if it does not exist
  39. */
  40. public function read($id);
  41. /**
  42. * Helper function called on write for sessions.
  43. *
  44. * @param integer $id ID that uniquely identifies session in database
  45. * @param mixed $data The value of the data to be saved.
  46. * @return boolean True for successful write, false otherwise.
  47. */
  48. public function write($id, $data);
  49. /**
  50. * Method called on the destruction of a session.
  51. *
  52. * @param integer $id ID that uniquely identifies session in database
  53. * @return boolean True for successful delete, false otherwise.
  54. */
  55. public function destroy($id);
  56. /**
  57. * Run the Garbage collection on the session storage. This method should vacuum all
  58. * expired or dead sessions.
  59. *
  60. * @param integer $expires Timestamp (defaults to current time)
  61. * @return boolean Success
  62. */
  63. public function gc($expires = null);
  64. }