[otrs-cvs] otrs/Kernel/System CacheInternal.pm,1.13,1.14
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/Kernel/System
In directory lancelot:/tmp/cvs-serv13150/Kernel/System
Modified Files:
CacheInternal.pm
Log Message:
Removed "CachePermanent" because it is always set to 1. This also means the CacheObject is always available, so I removed some if statements checking if it exists.
Small POD updates.
Author: mb
Index: CacheInternal.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/CacheInternal.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -2 -u -d -r1.13 -r1.14
--- CacheInternal.pm 20 Nov 2012 15:33:03 -0000 1.13
+++ CacheInternal.pm 14 Jan 2013 13:24:57 -0000 1.14
@@ -1,5 +1,5 @@
# --
# Kernel/System/CacheInternal.pm - all cache functions
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id$
@@ -28,7 +28,7 @@
Notice:
-This module is storing the cache information in memory and also permanently (e. g. in file system).
-So you need to take care, that you have not several instances of the CacheInternalObject at one
-runtime, because the in memory cache will fail then.
+This module is storing the cache information in memory and also permanently (e. g. on a file system).
+So you need to take care, that there is only one instance of the CacheInternalObject at a
+time, because otherwise the in-memory cache will fail.
=head1 PUBLIC INTERFACE
@@ -91,4 +91,7 @@
}
+ # create additional objects
+ $Self->{CacheObject} = Kernel::System::Cache->new(%Param);
+
# Enforce cache type restriction to make sure it works properly on all file systems.
if ( $Param{Type} !~ m{ \A [a-zA-Z0-9_]+ \z}smx ) {
@@ -103,12 +106,4 @@
$Self->{Type} = 'CacheInternal' . $Self->{Type};
- my $CachePermanent = 1;
-
- # $CachePermanent = 0;
-
- if ($CachePermanent) {
- $Self->{CacheObject} = Kernel::System::Cache->new(%Param);
- }
-
return $Self;
}
@@ -116,5 +111,5 @@
=item Set()
-set a new cache
+add a new item to cache
$CacheInternalObject->Set(
@@ -140,12 +135,10 @@
# set permanent cache
- if ( $Self->{CacheObject} ) {
- $Self->{CacheObject}->Set(
- Type => $Self->{Type},
- Key => $Param{Key},
- Value => $Param{Value},
- TTL => $Self->{TTL},
- );
- }
+ $Self->{CacheObject}->Set(
+ Type => $Self->{Type},
+ Key => $Param{Key},
+ Value => $Param{Value},
+ TTL => $Self->{TTL},
+ );
return 1;
@@ -154,5 +147,5 @@
=item Get()
-return a cache
+return a cached item
my $Value = $CacheInternalObject->Get(
@@ -177,11 +170,8 @@
# check permanent cache
- my $Cache;
- if ( $Self->{CacheObject} ) {
- $Cache = $Self->{CacheObject}->Get(
- Type => $Self->{Type},
- Key => $Param{Key},
- );
- }
+ my $Cache = $Self->{CacheObject}->Get(
+ Type => $Self->{Type},
+ Key => $Param{Key},
+ );
return if !defined $Cache;
@@ -194,5 +184,5 @@
=item Delete()
-delete a cache
+delete an item from cache
$CacheInternalObject->Delete(
@@ -216,11 +206,9 @@
delete $Self->{Cache}->{ $Param{Key} };
- # check permanent cache
- if ( $Self->{CacheObject} ) {
- $Self->{CacheObject}->Delete(
- Type => $Self->{Type},
- Key => $Param{Key},
- );
- }
+ # delete permanent cache
+ $Self->{CacheObject}->Delete(
+ Type => $Self->{Type},
+ Key => $Param{Key},
+ );
return 1;
@@ -229,5 +217,5 @@
=item CleanUp()
-delete all caches
+delete all cached items
$CacheInternalObject->CleanUp();
@@ -256,16 +244,13 @@
# delete permanent cache
- if ( $Self->{CacheObject} ) {
-
- if ( $Param{OtherType} ) {
- return if !$Self->{CacheObject}->CleanUp(
- Type => 'CacheInternal' . $Param{OtherType}
- );
- }
- else {
- return if !$Self->{CacheObject}->CleanUp(
- Type => $Self->{Type}
- );
- }
+ if ( $Param{OtherType} ) {
+ return if !$Self->{CacheObject}->CleanUp(
+ Type => 'CacheInternal' . $Param{OtherType}
+ );
+ }
+ else {
+ return if !$Self->{CacheObject}->CleanUp(
+ Type => $Self->{Type}
+ );
}
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log