Ticket #848 (defect)

Opened 3 months ago

TCache "set" and "add" with empty values

Status: new

Reported by: fragmaster b Assigned to: xue
Priority: low Milestone: 3.1.3
Component: Prado Framework v3 Version: 3.1
Severity: minor Keywords:
Cc:

Short Version

Please check $value to make sure it has some value before adding it to the cache. Applies to TCache->set and TCache->add.

Long Version

http://www.pradosoft.com/forum/index.php/topic,10101.0.html

I noticed that my PradoCache table had thousands of entries that were all 23B. Further inspection revealed that all of these values held nothing but an empty string. Worse yet they were also marked as never expire. I fixed this in my extension of TCache via the following, but it should probably be added directly to TCache so as not to trip up other users.

public function set($id, $value, $expire=0, $dependency=null){
	if (empty($value)) return false;
	else return parent::set($id, $value, $expire, $dependency);
}
	
public function add($id, $value, $expire=0, $dependency=null){
	if (empty($value)) return false;
	else return parent::add($id, $value, $expire, $dependency);
}