summaryrefslogtreecommitdiff
path: root/FS/FS/ClientAPI_SessionCache.pm
blob: d72fb39ce097c98eb23dc4e1f20dcf93b0445440 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package FS::ClientAPI_SessionCache;

use strict;
use vars qw($module);
use FS::UID qw(datasrc);
use FS::Conf;

#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::FileCache';
};

=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('%%%FREESIDE_CACHE%%%/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;