Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
244d9546
Commit
244d9546
authored
12 years ago
by
Tim Otten
Browse files
Options
Downloads
Plain Diff
Merge pull request
#383
from totten/revert-cache
CRM-12321 - Revert BAO_Cache changes
parents
d49e71b3
d35e469a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Core/BAO/Cache.php
+22
-63
22 additions, 63 deletions
CRM/Core/BAO/Cache.php
with
22 additions
and
63 deletions
CRM/Core/BAO/Cache.php
+
22
−
63
View file @
244d9546
...
...
@@ -58,32 +58,18 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
* @access public
*/
static
function
&
getItem
(
$group
,
$path
,
$componentID
=
NULL
)
{
static
$_cache
=
NULL
;
if
(
$_cache
===
NULL
)
{
$_cache
=
array
();
}
$argString
=
"CRM_CT_
{
$group
}
_
{
$path
}
_
{
$componentID
}
"
;
if
(
!
array_key_exists
(
$argString
,
$_cache
))
{
$cache
=
CRM_Utils_Cache
::
singleton
();
$_cache
[
$argString
]
=
$cache
->
get
(
$argString
);
if
(
!
$_cache
[
$argString
])
{
$dao
=
new
CRM_Core_DAO_Cache
();
$dao
->
group_name
=
$group
;
$dao
->
path
=
$path
;
$dao
->
component_id
=
$componentID
;
$data
=
NULL
;
if
(
$dao
->
find
(
TRUE
))
{
$data
=
unserialize
(
$dao
->
data
);
}
$dao
->
free
();
$_cache
[
$argString
]
=
$data
;
$cache
->
set
(
$argString
,
$_cache
[
$argString
]);
}
$dao
=
new
CRM_Core_DAO_Cache
();
$dao
->
group_name
=
$group
;
$dao
->
path
=
$path
;
$dao
->
component_id
=
$componentID
;
$data
=
NULL
;
if
(
$dao
->
find
(
TRUE
))
{
$data
=
unserialize
(
$dao
->
data
);
}
return
$_cache
[
$argString
];
$dao
->
free
();
return
$data
;
}
/**
...
...
@@ -97,34 +83,18 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
* @access public
*/
static
function
&
getItems
(
$group
,
$componentID
=
NULL
)
{
static
$_cache
=
NULL
;
if
(
$_cache
===
NULL
)
{
$_cache
=
array
();
}
$argString
=
"CRM_CT_CI_
{
$group
}
_
{
$componentID
}
"
;
if
(
!
array_key_exists
(
$argString
,
$_cache
))
{
$cache
=
CRM_Utils_Cache
::
singleton
();
$_cache
[
$argString
]
=
$cache
->
get
(
$argString
);
if
(
!
$_cache
[
$argString
])
{
$dao
=
new
CRM_Core_DAO_Cache
();
$dao
->
group_name
=
$group
;
$dao
->
component_id
=
$componentID
;
$dao
->
find
();
$result
=
array
();
// array($path => $data)
while
(
$dao
->
fetch
())
{
$result
[
$dao
->
path
]
=
unserialize
(
$dao
->
data
);
}
$dao
->
free
();
$_cache
[
$argString
]
=
$result
;
$cache
->
set
(
$argString
,
$_cache
[
$argString
]);
}
}
$dao
=
new
CRM_Core_DAO_Cache
();
$dao
->
group_name
=
$group
;
$dao
->
component_id
=
$componentID
;
$dao
->
find
();
return
$_cache
[
$argString
];
$result
=
array
();
// array($path => $data)
while
(
$dao
->
fetch
())
{
$result
[
$dao
->
path
]
=
unserialize
(
$dao
->
data
);
}
$dao
->
free
();
return
$result
;
}
/**
...
...
@@ -140,11 +110,6 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
* @access public
*/
static
function
setItem
(
&
$data
,
$group
,
$path
,
$componentID
=
NULL
)
{
static
$_cache
=
NULL
;
if
(
$_cache
===
NULL
)
{
$_cache
=
array
();
}
$dao
=
new
CRM_Core_DAO_Cache
();
$dao
->
group_name
=
$group
;
...
...
@@ -168,12 +133,6 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
$lock
->
release
();
$dao
->
free
();
// set the cache in memory
$argString
=
"CRM_CT_
{
$group
}
_
{
$path
}
_
{
$componentID
}
"
;
$cache
=
CRM_Utils_Cache
::
singleton
();
$data
=
unserialize
(
$dao
->
data
);
$cache
->
set
(
$argString
,
$data
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment