Session.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. namespace Config;
  3. use CodeIgniter\Config\BaseConfig;
  4. use CodeIgniter\Session\Handlers\BaseHandler;
  5. use CodeIgniter\Session\Handlers\FileHandler;
  6. class Session extends BaseConfig
  7. {
  8. /**
  9. * --------------------------------------------------------------------------
  10. * Session Driver
  11. * --------------------------------------------------------------------------
  12. *
  13. * The session storage driver to use:
  14. * - `CodeIgniter\Session\Handlers\FileHandler`
  15. * - `CodeIgniter\Session\Handlers\DatabaseHandler`
  16. * - `CodeIgniter\Session\Handlers\MemcachedHandler`
  17. * - `CodeIgniter\Session\Handlers\RedisHandler`
  18. *
  19. * @var class-string<BaseHandler>
  20. */
  21. public string $driver = FileHandler::class;
  22. /**
  23. * --------------------------------------------------------------------------
  24. * Session Cookie Name
  25. * --------------------------------------------------------------------------
  26. *
  27. * The session cookie name, must contain only [0-9a-z_-] characters
  28. */
  29. public string $cookieName = 'ci_session';
  30. /**
  31. * --------------------------------------------------------------------------
  32. * Session Expiration
  33. * --------------------------------------------------------------------------
  34. *
  35. * The number of SECONDS you want the session to last.
  36. * Setting to 0 (zero) means expire when the browser is closed.
  37. */
  38. public int $expiration = 7200;
  39. /**
  40. * --------------------------------------------------------------------------
  41. * Session Save Path
  42. * --------------------------------------------------------------------------
  43. *
  44. * The location to save sessions to and is driver dependent.
  45. *
  46. * For the 'files' driver, it's a path to a writable directory.
  47. * WARNING: Only absolute paths are supported!
  48. *
  49. * For the 'database' driver, it's a table name.
  50. * Please read up the manual for the format with other session drivers.
  51. *
  52. * IMPORTANT: You are REQUIRED to set a valid save path!
  53. */
  54. public string $savePath = WRITEPATH . 'session';
  55. /**
  56. * --------------------------------------------------------------------------
  57. * Session Match IP
  58. * --------------------------------------------------------------------------
  59. *
  60. * Whether to match the user's IP address when reading the session data.
  61. *
  62. * WARNING: If you're using the database driver, don't forget to update
  63. * your session table's PRIMARY KEY when changing this setting.
  64. */
  65. public bool $matchIP = false;
  66. /**
  67. * --------------------------------------------------------------------------
  68. * Session Time to Update
  69. * --------------------------------------------------------------------------
  70. *
  71. * How many seconds between CI regenerating the session ID.
  72. */
  73. public int $timeToUpdate = 300;
  74. /**
  75. * --------------------------------------------------------------------------
  76. * Session Regenerate Destroy
  77. * --------------------------------------------------------------------------
  78. *
  79. * Whether to destroy session data associated with the old session ID
  80. * when auto-regenerating the session ID. When set to FALSE, the data
  81. * will be later deleted by the garbage collector.
  82. */
  83. public bool $regenerateDestroy = false;
  84. /**
  85. * --------------------------------------------------------------------------
  86. * Session Database Group
  87. * --------------------------------------------------------------------------
  88. *
  89. * DB Group for the database session.
  90. */
  91. public ?string $DBGroup = null;
  92. /**
  93. * --------------------------------------------------------------------------
  94. * Lock Retry Interval (microseconds)
  95. * --------------------------------------------------------------------------
  96. *
  97. * This is used for RedisHandler.
  98. *
  99. * Time (microseconds) to wait if lock cannot be acquired.
  100. * The default is 100,000 microseconds (= 0.1 seconds).
  101. */
  102. public int $lockRetryInterval = 100_000;
  103. /**
  104. * --------------------------------------------------------------------------
  105. * Lock Max Retries
  106. * --------------------------------------------------------------------------
  107. *
  108. * This is used for RedisHandler.
  109. *
  110. * Maximum number of lock acquisition attempts.
  111. * The default is 300 times. That is lock timeout is about 30 (0.1 * 300)
  112. * seconds.
  113. */
  114. public int $lockMaxRetries = 300;
  115. }