Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
9703f18c
Commit
9703f18c
authored
Jun 29, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
2431e481
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
Doctrine.php
lib/Doctrine.php
+1
-0
Hydrate.php
lib/Doctrine/Hydrate.php
+24
-5
No files found.
lib/Doctrine.php
View file @
9703f18c
...
@@ -191,6 +191,7 @@ final class Doctrine
...
@@ -191,6 +191,7 @@ final class Doctrine
const
ATTR_NS_GAP_DECREASE_EXP
=
132
;
const
ATTR_NS_GAP_DECREASE_EXP
=
132
;
const
ATTR_CACHE
=
150
;
const
ATTR_CACHE
=
150
;
const
ATTR_CACHE_LIFESPAN
=
151
;
const
ATTR_LOAD_REFERENCES
=
153
;
const
ATTR_LOAD_REFERENCES
=
153
;
/**
/**
...
...
lib/Doctrine/Hydrate.php
View file @
9703f18c
...
@@ -133,8 +133,14 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
...
@@ -133,8 +133,14 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
* @var array
* @var array
*/
*/
protected
$_cache
;
protected
$_cache
;
/**
* @var boolean $_expireCache a boolean value that indicates whether or not to force cache expiration
*/
protected
$_expireCache
=
false
;
protected
$_timeToLive
;
protected
$_tableAliases
=
array
();
protected
$_tableAliases
=
array
();
/**
/**
* @var array $_tableAliasSeeds A simple array keys representing table aliases and values
* @var array $_tableAliasSeeds A simple array keys representing table aliases and values
* as table alias seeds. The seeds are used for generating short table
* as table alias seeds. The seeds are used for generating short table
...
@@ -199,15 +205,27 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
...
@@ -199,15 +205,27 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
}
}
$this
->
_cache
=
$driver
;
$this
->
_cache
=
$driver
;
return
$this
->
setTimeToLive
(
$timeToLive
);
return
$this
->
setCacheLifeSpan
(
$timeToLive
);
}
/**
* expireCache
*
* @param boolean $expire whether or not to force cache expiration
* @return Doctrine_Hydrate this object
*/
public
function
expireCache
(
$expire
=
true
)
{
$this
->
_expireCache
=
true
;
return
$this
;
}
}
/**
/**
* set
TimeToLive
* set
CacheLifeSpan
*
*
* @param integer $timeToLive how long the cache entry is valid
* @param integer $timeToLive how long the cache entry is valid
* @return Doctrine_Hydrate this object
* @return Doctrine_Hydrate this object
*/
*/
public
function
set
TimeToLive
(
$timeToLive
)
public
function
set
CacheLifeSpan
(
$timeToLive
)
{
{
if
(
$timeToLive
!==
null
)
{
if
(
$timeToLive
!==
null
)
{
$timeToLive
=
(
int
)
$timeToLive
;
$timeToLive
=
(
int
)
$timeToLive
;
...
@@ -745,7 +763,8 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
...
@@ -745,7 +763,8 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
// calculate hash for dql query
// calculate hash for dql query
$hash
=
md5
(
$dql
.
var_export
(
$params
,
true
));
$hash
=
md5
(
$dql
.
var_export
(
$params
,
true
));
$cached
=
$cacheDriver
->
fetch
(
$hash
);
$cached
=
(
$this
->
_expireCache
)
?
null
:
$cacheDriver
->
fetch
(
$hash
);
if
(
$cached
===
null
)
{
if
(
$cached
===
null
)
{
// cache miss
// cache miss
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment