From 95330b7f29663dab81f53d1a438e4d927b6c5f66 Mon Sep 17 00:00:00 2001 From: Colin Mollenhour Date: Wed, 3 Feb 2016 13:13:08 -0500 Subject: [PATCH] Expose failed lock attempts. Get normal lifetime from config handler. --- src/Cm/RedisSession/Handler.php | 13 ++++++++++++- src/Cm/RedisSession/Handler/ConfigInterface.php | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Cm/RedisSession/Handler.php b/src/Cm/RedisSession/Handler.php index 46c03ae..0780943 100644 --- a/src/Cm/RedisSession/Handler.php +++ b/src/Cm/RedisSession/Handler.php @@ -627,6 +627,16 @@ public function gc($maxLifeTime) return true; } + /** + * Get the number of failed lock attempts + * + * @return int + */ + public function getFailedLockAttempts() + { + return $this->failedLockAttempts; + } + /** * Get lock lifetime * @@ -664,9 +674,10 @@ private function getLifeTime() // Neither bot nor first write if ($lifeTime === null) { - $this->_lifeTime = self::DEFAULT_LIFETIME; + $lifeTime = $this->config->getLifetime(); } + $this->_lifeTime = $lifeTime; if ($this->_lifeTime < $this->_minLifetime) { $this->_lifeTime = $this->_minLifetime; } diff --git a/src/Cm/RedisSession/Handler/ConfigInterface.php b/src/Cm/RedisSession/Handler/ConfigInterface.php index 61a5412..2d4b9c1 100644 --- a/src/Cm/RedisSession/Handler/ConfigInterface.php +++ b/src/Cm/RedisSession/Handler/ConfigInterface.php @@ -102,6 +102,13 @@ public function getCompressionLibrary(); */ public function getMaxConcurrency(); + /** + * Get the normal session lifetime + * + * @return int + */ + public function getLifetime(); + /** * Get the maximum session lifetime *