freeside/FS/FS clientapi_session.pm,NONE,1.1 clientapi_session_field.pm,NONE,1.1 ClientAPI_SessionCache.pm,NONE,1.1 Conf.pm,1.119,1.120
ivan
ivan at pouncequick.420.am
Tue Feb 8 12:22:51 PST 2005
- Previous message: freeside/FS/t clientapi_session.t,NONE,1.1 clientapi_session_field.t,NONE,1.1 ClientAPI_SessionCache.t,NONE,1.1
- Next message: freeside/FS/FS/ClientAPI MyAccount.pm,1.33,1.34 Signup.pm,1.20,1.21 Agent.pm,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory pouncequick:/tmp/cvs-serv9349/FS/FS
Modified Files:
Conf.pm
Added Files:
clientapi_session.pm clientapi_session_field.pm
ClientAPI_SessionCache.pm
Log Message:
make self-service session cache module configurable, start framework for in-database session cache
--- NEW FILE: clientapi_session.pm ---
package FS::clientapi_session;
use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs );
@ISA = qw(FS::Record);
=head1 NAME
FS::clientapi_session - Object methods for clientapi_session records
=head1 SYNOPSIS
use FS::clientapi_session;
$record = new FS::clientapi_session \%hash;
$record = new FS::clientapi_session { 'column' => 'value' };
$error = $record->insert;
$error = $new_record->replace($old_record);
$error = $record->delete;
$error = $record->check;
=head1 DESCRIPTION
An FS::clientapi_session object represents an FS::ClientAPI session.
FS::clientapi_session inherits from FS::Record. The following fields are
currently supported:
=over 4
=item sessionnum - primary key
=item sessionid - session ID
=item namespace - session namespace
=back
=head1 METHODS
=over 4
=item new HASHREF
Creates a new record. To add the record to the database, see L<"insert">.
Note that this stores the hash reference, not a distinct copy of the hash it
points to. You can ask the object for a copy with the I<hash> method.
=cut
# the new method can be inherited from FS::Record, if a table method is defined
sub table { 'clientapi_session'; }
=item insert
Adds this record to the database. If there is an error, returns the error,
otherwise returns false.
=cut
# the insert method can be inherited from FS::Record
=item delete
Delete this record from the database.
=cut
# the delete method can be inherited from FS::Record
=item replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error,
returns the error, otherwise returns false.
=cut
# the replace method can be inherited from FS::Record
=item check
Checks all fields to make sure this is a valid record. If there is
an error, returns the error, otherwise returns false. Called by the insert
and replace methods.
=cut
# the check method should currently be supplied - FS::Record contains some
# data checking routines
sub check {
my $self = shift;
my $error =
$self->ut_numbern('primary_key')
|| $self->ut_number('validate_other_fields')
;
return $error if $error;
$self->SUPER::check;
}
=back
=head1 BUGS
=head1 SEE ALSO
L<FS::ClientAPI>, <FS::Record>, schema.html from the base documentation.
=cut
1;
--- NEW FILE: ClientAPI_SessionCache.pm ---
package FS::ClientAPI_SessionCache;
use strict;
use vars qw($module);
use FS::UID qw(datasrc);
#ask FS::UID to run this stuff for us later
install_callback FS::UID sub {
my $conf = new FS::Conf;
$module = $conf->config('selfservice_server-cache_module')
|| 'Cache::SharedMemoryCache';
};
=head1 NAME
FS::ClientAPI_SessionCache;
=head1 SYNOPSIS
=head1 DESCRIPTION
Minimal Cache::Cache-alike interface for storing session cache information.
Backends to Cache::SharedMemoryCache, Cache::FileCache, or an internal
implementation which stores information in the clientapi_session and
clientapi_session_field database tables.
=head1 METHODS
=over 4
=item new
=cut
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
unless ( $module =~ /^_Database$/ ) {
eval "use $module;";
die $@ if $@;
my $self = $module->new(@_);
$self->set_cache_root('/usr/local/etc/freeside/clientapi_session.'.datasrc)
if $module =~ /^Cache::FileCache$/;
$self;
} else {
my $self = shift;
bless ($self, $class);
}
}
sub get {
my($self, $session_id) = @_;
die '_Database self-service session cache not yet implemented';
}
sub set {
my($self, $session_id, $session, $expiration) = @_;
die '_Database self-service session cache not yet implemented';
}
sub remove {
my($self, $session_id) = @_;
die '_Database self-service session cache not yet implemented';
}
=back
=head1 BUGS
Minimal documentation.
=head1 SEE ALSO
L<Cache::Cache>, L<FS::clientapi_session>, L<FS::clientapi_session_field>
=cut
1;
Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- Conf.pm 19 Jan 2005 00:57:10 -0000 1.119
+++ Conf.pm 8 Feb 2005 20:22:46 -0000 1.120
@@ -1383,6 +1383,13 @@
'type' => 'checkbox',
},
+ { 'key' => 'selfservice_server-cache_module',
+ 'section' => '',
+ 'description' => 'Module used to store self-service session information. All modules handle any number of self-service servers. Cache::SharedMemoryCache is appropriate for a single database / single Freeside server. Cache::FileCache is useful for multiple databases on a single server, or when IPC::ShareLite is not available (i.e. FreeBSD).', # _Database stores session information in the database and is appropriate for multiple Freeside servers, but may be slower.',
+ 'type' => 'select',
+ 'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
+ },
+
);
1;
--- NEW FILE: clientapi_session_field.pm ---
package FS::clientapi_session_field;
use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs );
@ISA = qw(FS::Record);
=head1 NAME
FS::clientapi_session_field - Object methods for clientapi_session_field records
=head1 SYNOPSIS
use FS::clientapi_session_field;
$record = new FS::clientapi_session_field \%hash;
$record = new FS::clientapi_session_field { 'column' => 'value' };
$error = $record->insert;
$error = $new_record->replace($old_record);
$error = $record->delete;
$error = $record->check;
=head1 DESCRIPTION
An FS::clientapi_session_field object represents a FS::ClientAPI session data
field. FS::clientapi_session_field inherits from FS::Record. The following
fields are currently supported:
=over 4
=item fieldnum - primary key
=item sessionnum - Base ClientAPI sesison (see L<FS::clientapi_session>)
=item fieldname
=item fieldvalie
=back
=head1 METHODS
=over 4
=item new HASHREF
Creates a new record. To add the record to the database, see L<"insert">.
Note that this stores the hash reference, not a distinct copy of the hash it
points to. You can ask the object for a copy with the I<hash> method.
=cut
# the new method can be inherited from FS::Record, if a table method is defined
sub table { 'clientapi_session_field'; }
=item insert
Adds this record to the database. If there is an error, returns the error,
otherwise returns false.
=cut
# the insert method can be inherited from FS::Record
=item delete
Delete this record from the database.
=cut
# the delete method can be inherited from FS::Record
=item replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error,
returns the error, otherwise returns false.
=cut
# the replace method can be inherited from FS::Record
=item check
Checks all fields to make sure this is a valid record. If there is
an error, returns the error, otherwise returns false. Called by the insert
and replace methods.
=cut
# the check method should currently be supplied - FS::Record contains some
# data checking routines
sub check {
my $self = shift;
my $error =
$self->ut_numbern('primary_key')
|| $self->ut_number('validate_other_fields')
;
return $error if $error;
$self->SUPER::check;
}
=back
=head1 BUGS
The author forgot to customize this manpage.
=head1 SEE ALSO
L<FS::clientapi_session>, L<FS::ClientAPI, L<FS::Record>, schema.html from the
base documentation.
=cut
1;
- Previous message: freeside/FS/t clientapi_session.t,NONE,1.1 clientapi_session_field.t,NONE,1.1 ClientAPI_SessionCache.t,NONE,1.1
- Next message: freeside/FS/FS/ClientAPI MyAccount.pm,1.33,1.34 Signup.pm,1.20,1.21 Agent.pm,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list