CakeSessionHandlerInterface.php 2.0 KB

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