|
From: Chris W. <la...@us...> - 2001-10-17 04:47:10
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract/Cache
In directory usw-pr-cvs1:/tmp/cvs-serv25485/OpenInteract/Cache
Modified Files:
File.pm IPC.pm
Log Message:
modify to reflect server configuration file changes
Index: File.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Cache/File.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** File.pm 2001/07/11 12:33:04 1.1
--- File.pm 2001/10/17 04:47:07 1.2
***************
*** 16,23 ****
my $DEFAULT_EXPIRE = 86400; # 1 day
! sub class_initialize {
my ( $class, $p ) = @_;
! # Allow values that are passed in to override anything
# set in the config object
--- 16,23 ----
my $DEFAULT_EXPIRE = 86400; # 1 day
! sub class_initialize {
my ( $class, $p ) = @_;
! # Allow values that are passed in to override anything
# set in the config object
***************
*** 30,34 ****
if ( ref $p->{config} ) {
! my $cache_info = $p->{config}->{cache_info}->{data};
$cache_dir ||= $p->{config}->get_dir( 'cache' );
$max_size ||= $cache_info->{max_size};
--- 30,34 ----
if ( ref $p->{config} ) {
! my $cache_info = $p->{config}{cache_info}{data};
$cache_dir ||= $p->{config}->get_dir( 'cache' );
$max_size ||= $cache_info->{max_size};
***************
*** 49,53 ****
$max_expire ||= $DEFAULT_EXPIRE;
! # Set some extra values: they can be passed in or set via the
# config, but if they're not it's no big deal
--- 49,53 ----
$max_expire ||= $DEFAULT_EXPIRE;
! # Set some extra values: they can be passed in or set via the
# config, but if they're not it's no big deal
***************
*** 56,68 ****
$R->DEBUG && $R->scrib( 1, "Using the following settings:\n",
! "Size: $max_size\n",
"Expire: $max_expire\n"
"Dir: $cache_dir" );
! my $cache = File::Cache->new( { expires_in => $max_expire,
! max_size => $max_size,
cache_key => $cache_dir,
%extra } )
|| warn " (Cache/File): Cannot create cache!\n";
! my $stash_class = $p->{config}->{stash_class};
$stash_class->set_stash( 'cache', $cache );
return 1;
--- 56,68 ----
$R->DEBUG && $R->scrib( 1, "Using the following settings:\n",
! "Size: $max_size\n",
"Expire: $max_expire\n"
"Dir: $cache_dir" );
! my $cache = File::Cache->new( { expires_in => $max_expire,
! max_size => $max_size,
cache_key => $cache_dir,
%extra } )
|| warn " (Cache/File): Cannot create cache!\n";
! my $stash_class = $p->{config}{server_info}{stash_class};
$stash_class->set_stash( 'cache', $cache );
return 1;
***************
*** 72,85 ****
# params: 0 = class ; 1 = key
! sub _get_data {
my $R = OpenInteract::Request->instance;
! return $R->cache->get( $_[1] );
}
# params: 0 = class ; 1 = key; 2 = data ; 3 = expires (in seconds)
! sub _set_data {
my $R = OpenInteract::Request->instance;
! return $R->cache->set( $_[1], $_[2], $_[3] );
}
--- 72,85 ----
# params: 0 = class ; 1 = key
! sub _get_data {
my $R = OpenInteract::Request->instance;
! return $R->cache->get( $_[1] );
}
# params: 0 = class ; 1 = key; 2 = data ; 3 = expires (in seconds)
! sub _set_data {
my $R = OpenInteract::Request->instance;
! return $R->cache->set( $_[1], $_[2], $_[3] );
}
***************
*** 87,91 ****
sub _clear_data {
my $R = OpenInteract::Request->instance;
! return $R->cache->set( $_[1], undef );
}
--- 87,91 ----
sub _clear_data {
my $R = OpenInteract::Request->instance;
! return $R->cache->set( $_[1], undef );
}
***************
*** 119,126 ****
=head1 DESCRIPTION
! Subclass of L<OpenInteract::Cache> that uses the filesystem to
cache objects.
! One note: if file space becomes an issue, it would be a
good idea to put this on the fastest drive (or drive
array) possible.
--- 119,126 ----
=head1 DESCRIPTION
! Subclass of L<OpenInteract::Cache> that uses the filesystem to
cache objects.
! One note: if file space becomes an issue, it would be a
good idea to put this on the fastest drive (or drive
array) possible.
Index: IPC.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/Cache/IPC.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IPC.pm 2001/07/11 12:33:04 1.1
--- IPC.pm 2001/10/17 04:47:07 1.2
***************
*** 14,21 ****
my $DEFAULT_EXPIRE = 0;
! sub class_initialize {
my ( $class, $p ) = @_;
! # Allow values that are passed in to override anything
# set in the config object
--- 14,21 ----
my $DEFAULT_EXPIRE = 0;
! sub class_initialize {
my ( $class, $p ) = @_;
! # Allow values that are passed in to override anything
# set in the config object
***************
*** 24,34 ****
# If we were given a config object, fill in the empty values
!
if ( ref $p->{config} ) {
! my $cache_info = $p->{config}->{cache_info}->{ipc};
$max_expire ||= $cache_info->{max_expire};
$cache_key ||= $cache_info->{key};
}
!
# If a value isn't set, use the default from the class
# configuration above.
--- 24,34 ----
# If we were given a config object, fill in the empty values
!
if ( ref $p->{config} ) {
! my $cache_info = $p->{config}{cache_info}{ipc};
$max_expire ||= $cache_info->{max_expire};
$cache_key ||= $cache_info->{key};
}
!
# If a value isn't set, use the default from the class
# configuration above.
***************
*** 38,45 ****
my $R = OpenInteract::Request->instance;
$R->DEBUG && $R->scrib( 1, "Using the following settings:\n", "Expire: $max_expire\n Key: $cache_key" );
! my $cache = IPC::Cache->new( { expires_in => $max_expire,
cache_key => $cache_key } )
|| warn " (Cache/IPC): Cannot create cache!\n";
! my $stash_class = $p->{config}->{stash_class};
$stash_class->set_stash( 'ipc-cache', $cache );
return 1;
--- 38,45 ----
my $R = OpenInteract::Request->instance;
$R->DEBUG && $R->scrib( 1, "Using the following settings:\n", "Expire: $max_expire\n Key: $cache_key" );
! my $cache = IPC::Cache->new( { expires_in => $max_expire,
cache_key => $cache_key } )
|| warn " (Cache/IPC): Cannot create cache!\n";
! my $stash_class = $p->{config}{server_info}{stash_class};
$stash_class->set_stash( 'ipc-cache', $cache );
return 1;
***************
*** 49,53 ****
# params: 0 = class ; 1 = key
! sub _get_meta {
return OpenInteract::Request->instance->get_stash( 'ipc-cache' )->get( $_[1] );
}
--- 49,53 ----
# params: 0 = class ; 1 = key
! sub _get_meta {
return OpenInteract::Request->instance->get_stash( 'ipc-cache' )->get( $_[1] );
}
***************
*** 56,60 ****
# params: 0 = class ; 1 = key ; 2 = data ; 3 = expires (in seconds)
! sub _set_meta {
return OpenInteract::Request->instance->get_stash( 'ipc-cache' )->set( $_[1], $_[2], $_[3] );
}
--- 56,60 ----
# params: 0 = class ; 1 = key ; 2 = data ; 3 = expires (in seconds)
! sub _set_meta {
return OpenInteract::Request->instance->get_stash( 'ipc-cache' )->set( $_[1], $_[2], $_[3] );
}
***************
*** 63,67 ****
# params: 0 = class ; 1 = key ; 2 = data for comparison
! sub check_meta {
return $_[2] == OpenInteract::Request->instance->get_stash( 'ipc-cache' )->get( $_[1] );
}
--- 63,67 ----
# params: 0 = class ; 1 = key ; 2 = data for comparison
! sub check_meta {
return $_[2] == OpenInteract::Request->instance->get_stash( 'ipc-cache' )->get( $_[1] );
}
|