Data at Your Fingertips: Explore Our New Reporting and Statistical Capabilities By Ryan Ashbrook 18 hours ago
TSP Posted March 13, 2018 Share Posted March 13, 2018 Hi, 1) The method storeWithExpire in system/Data/Cache.php doesn't return any indication on whether the value was stored successfully. However, for example, the memcache class (system/Data/Cache/Memcache.php) does return a boolean value in the set-method, which is the method that is called within storeWithExpire in the \IPS\Data\Cache-class. The same seems to be the case in other cache-classes. Could you please return the value that the set()-method returns when it's called in storeWithExpire? 2) Also, the method storeWithExpire in Cache.php does this: <?php if ( $this->set( $key, $this->encode( $value ), $expire ) ) { $this->_data[ $key ] = $value; $this->_exists[ $key ] = $key; } But the same method in the Cache/None.php-class doesn't do the equivalent. <?php public function storeWithExpire( $key, $value, \IPS\DateTime $expire, $fallback=FALSE ) { if ( $fallback ) { \IPS\Db::i()->replace( 'core_cache', array( 'cache_key' => $key, 'cache_value' => json_encode( $value ), 'cache_expire' => $expire->getTimestamp() ) ); } } Could you change the method storeWithExpire in None.php to also set $this->_data and $this->_exists. Link to comment Share on other sites More sharing options...
BomAle Posted March 22, 2018 Share Posted March 22, 2018 On 13/3/2018 at 3:05 PM, TSP said: But the same method in the Cache/None.php-class doesn't do the equivalent. In any case you can check if value is stored with: $return = NULL; try { $return = \IPS\Data\Cache::i()->getWithExpire( $key, TRUE ); } catch( \OutOfRangeException $e ){} only this method currently take care of values set with $fallback=TRUE Link to comment Share on other sites More sharing options...
TSP Posted March 22, 2018 Author Share Posted March 22, 2018 20 minutes ago, BomAle said: In any case you can check if value is stored with: $return = NULL; try { $return = \IPS\Data\Cache::i()->getWithExpire( $key, TRUE ); } catch( \OutOfRangeException $e ){} only this method currently take care of values set with $fallback=TRUE Yes, but that currently does an extra database-call because they don't set $this->_data and $this->_exists on save. Which is why I wouldn't want to do that. Link to comment Share on other sites More sharing options...
BomAle Posted March 22, 2018 Share Posted March 22, 2018 Quote Yes, but that currently does an extra database-call because they don't set $this->_data and $this->_exists on save. Which is why I wouldn't want to do that. I hope this fixed soon, I see this code on dispatcher front for ouput guest cache page. Link to comment Share on other sites More sharing options...
Stuart Silvester Posted March 22, 2018 Share Posted March 22, 2018 These issues were addressed in 4.3 Beta 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.