{"action":"created","issue":{"url":"https://api.github.com/repos/aerospike/aerospike-client-php/issues/79","repository_url":"https://api.github.com/repos/aerospike/aerospike-client-php","labels_url":"https://api.github.com/repos/aerospike/aerospike-client-php/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/aerospike/aerospike-client-php/issues/79/comments","events_url":"https://api.github.com/repos/aerospike/aerospike-client-php/issues/79/events","html_url":"https://github.com/aerospike/aerospike-client-php/issues/79","id":135949919,"number":79,"title":"Use session.gc_maxlifetime for TTL instead of session.cache_expire ","user":{"login":"jcross-class","id":16858543,"avatar_url":"https://avatars.githubusercontent.com/u/16858543?v=3","gravatar_id":"","url":"https://api.github.com/users/jcross-class","html_url":"https://github.com/jcross-class","followers_url":"https://api.github.com/users/jcross-class/followers","following_url":"https://api.github.com/users/jcross-class/following{/other_user}","gists_url":"https://api.github.com/users/jcross-class/gists{/gist_id}","starred_url":"https://api.github.com/users/jcross-class/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcross-class/subscriptions","organizations_url":"https://api.github.com/users/jcross-class/orgs","repos_url":"https://api.github.com/users/jcross-class/repos","events_url":"https://api.github.com/users/jcross-class/events{/privacy}","received_events_url":"https://api.github.com/users/jcross-class/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-24T04:19:28Z","updated_at":"2016-04-06T20:53:51Z","closed_at":null,"body":"The aerospike PHP Session handler is set up to use the session.cache_expire ini value for the aerospike record TTL:\r\n[PHP ini session.cache_expire accessed](https://github.com/aerospike/aerospike-client-php/blob/9ec7ecfb3acdd4d40bf8589e8d2cbc699e477d8b/src/aerospike/aerospike_common.h#L102)\r\n[PHP ini session.cache_expire used to set aerospike record TTL](https://github.com/aerospike/aerospike-client-php/blob/9ec7ecfb3acdd4d40bf8589e8d2cbc699e477d8b/src/aerospike/aerospike_session_handler.c#L351)\r\n\r\nFrom reading through the PHP documentation on how sessions are handled, and from looking at how this is handled by other PHP session handlers, I think that instead of session.cache_expire for the aerospike record TTL, [session.gc_maxlifetime](http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime) should be used.  I've found this to be the case for other session handler implementations:\r\n* For session information stored in files (the PHP default) session.gc_maxlifetime value is used to determine the earliest a file can be deleted from the file system.  The PHP documentation doesn't make that clear from what I can tell, but how it works is reference frequently when people discuss problems with PHP sessions.  [This is one such example](http://stackoverflow.com/a/3555570).\r\n* The phpredis extension [uses session.gc_maxlifetime](https://github.com/phpredis/phpredis#php-session-handler)\r\n* The php-memcached extension [uses session.gc_maxlifetime](https://github.com/php-memcached-dev/php-memcached/blob/master/php_memcached_session.c#L360)\r\n\r\nThe PHP documentation isn't clear, but [session.cache_expire](http://php.net/manual/en/session.configuration.php#ini.session.cache-expire) is used to set the HTTP expires header for any pages generated that use a PHP session.  The expires header tells the browser how long to use the returned page from cache.\r\n\r\n[session.cache-limiter](http://php.net/manual/en/session.configuration.php#ini.session.cache-limiter) controls the caching mode for returned pages.  There's a decent explanation related to it [here](http://php.net/manual/en/function.session-cache-limiter.php).  By default, PHP sets session.cache-limiter to nocache.  When that is the case, the [documentation says that session.cache_expire](http://php.net/manual/en/session.configuration.php#ini.session.cache-expire) has no effect.  If someone switches from the default nocache to a caching mode, and then sets the session.cache_expire to a higher than default value (default is 180) to make the aerospike TTL a reasonable value (say 1 day), then that could cause client browsers to cache PHP session generated pages for too long."},"comment":{"url":"https://api.github.com/repos/aerospike/aerospike-client-php/issues/comments/206562819","html_url":"https://github.com/aerospike/aerospike-client-php/issues/79#issuecomment-206562819","issue_url":"https://api.github.com/repos/aerospike/aerospike-client-php/issues/79","id":206562819,"user":{"login":"jboone100","id":10550013,"avatar_url":"https://avatars.githubusercontent.com/u/10550013?v=3","gravatar_id":"","url":"https://api.github.com/users/jboone100","html_url":"https://github.com/jboone100","followers_url":"https://api.github.com/users/jboone100/followers","following_url":"https://api.github.com/users/jboone100/following{/other_user}","gists_url":"https://api.github.com/users/jboone100/gists{/gist_id}","starred_url":"https://api.github.com/users/jboone100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jboone100/subscriptions","organizations_url":"https://api.github.com/users/jboone100/orgs","repos_url":"https://api.github.com/users/jboone100/repos","events_url":"https://api.github.com/users/jboone100/events{/privacy}","received_events_url":"https://api.github.com/users/jboone100/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T20:53:50Z","updated_at":"2016-04-06T20:53:50Z","body":"I had a look into this and you are correct. Version 3.4.8 of the PHP client will use `session.gc_maxlifetime` for the session timeout. Thanks for pointing this out."}}