eWay self-signup fixes
[freeside.git] / FS / FS / ClientAPI_SessionCache.pm
1 package FS::ClientAPI_SessionCache;
2
3 use strict;
4 use vars qw($module);
5 use FS::UID qw(datasrc);
6 use FS::Conf;
7
8 #ask FS::UID to run this stuff for us later
9 install_callback FS::UID sub { 
10   my $conf = new FS::Conf;
11   $module = $conf->config('selfservice_server-cache_module')
12             || 'Cache::FileCache';
13 };
14
15 =head1 NAME
16
17 FS::ClientAPI_SessionCache;
18
19 =head1 SYNOPSIS
20
21 =head1 DESCRIPTION
22
23 Minimal Cache::Cache-alike interface for storing session cache information.
24 Backends to Cache::SharedMemoryCache, Cache::FileCache, or an internal
25 implementation which stores information in the clientapi_session and
26 clientapi_session_field database tables.
27
28 =head1 METHODS
29
30 =over 4
31
32 =item new
33
34 =cut
35
36 sub new {
37   my $proto = shift;
38   my $class = ref($proto) || $proto;
39   unless ( $module =~ /^_Database$/ ) {
40     eval "use $module;";
41     die $@ if $@;
42     my $self = $module->new(@_);
43     $self->set_cache_root('%%%FREESIDE_CACHE%%%/clientapi_session.'.datasrc)
44       if $module =~ /^Cache::FileCache$/;
45     $self;
46   } else {
47     my $self = shift;
48     bless ($self, $class);
49   }
50 }
51
52 sub get {
53   my($self, $session_id) = @_;
54   die '_Database self-service session cache not yet implemented';
55 }
56
57 sub set {
58   my($self, $session_id, $session, $expiration) = @_;
59   die '_Database self-service session cache not yet implemented';
60 }
61
62 sub remove {
63   my($self, $session_id) = @_;
64   die '_Database self-service session cache not yet implemented';
65 }
66
67 =back
68
69 =head1 BUGS
70
71 Minimal documentation.
72
73 =head1 SEE ALSO
74
75 L<Cache::Cache>, L<FS::clientapi_session>, L<FS::clientapi_session_field>
76
77 =cut
78
79 1;