Commit 03992852 authored by bcosca's avatar bcosca
Browse files

Add entropy to cache hash

parent e2a65931
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -151,8 +151,9 @@ class Mapper extends \DB\Cursor {
		$db=$this->db;
		$now=microtime(TRUE);
		if (!$fw->get('CACHE') || !$ttl || !($cached=$cache->exists(
			$hash=$fw->hash($fw->stringify(array($filter,$options))).'.jig',
				$data)) || $cached[0]+$ttl<microtime(TRUE)) {
			$hash=$fw->hash($this->db->dir.
				$fw->stringify(array($filter,$options))).'.jig',$data)) ||
			$cached[0]+$ttl<microtime(TRUE)) {
			$data=$db->read($this->file);
			foreach ($data as $id=>&$doc) {
				$doc['_id']=$id;
+3 −3
Original line number Diff line number Diff line
@@ -110,9 +110,9 @@ class Mapper extends \DB\Cursor {
		);
		$fw=\Base::instance();
		$cache=\Cache::instance();
		if (!($cached=$cache->exists($hash=$fw->hash($fw->stringify(
			array($fields,$filter,$options))).'.mongo',$result)) || !$ttl ||
			$cached[0]+$ttl<microtime(TRUE)) {
		if (!($cached=$cache->exists($hash=$fw->hash($this->db->dsn.
			$fw->stringify(array($fields,$filter,$options))).'.mongo',
			$result)) || !$ttl || $cached[0]+$ttl<microtime(TRUE)) {
			if ($options['group']) {
				$tmp=$this->db->selectcollection(
					$fw->get('HOST').'.'.$fw->get('BASE').'.'.uniqid().'.tmp'