1Apache::DBI::Cache::ImaUDsBeIr(3C)ontributed Perl DocumeAnptaacthieo:n:DBI::Cache::ImaDBI(3)
2
3
4
6 Apache::DBI::Cache::ImaDBI - make Apache::DBI::Cache work with
7 Class::DBI
8
10 In your httpd.conf:
11 <Perl>
12 use Apache::DBI::Cache ...;
13 use Apache::DBI::Cache::ImaDBI patch=>'Ima::DBI';
14 </Perl>
15
16 Then use Class::DBI in your modules as usual.
17
18 or
19
20 In your httpd.conf:
21 <Perl>
22 use Apache::DBI::Cache ...;
23 use Apache::DBI::Cache::ImaDBI patch=>'My::Class';
24 </Perl>
25
26 package My::Class;
27 use base qw/Class::DBI/;
28
29 or
30
31 In your httpd.conf:
32 <Perl>
33 use Apache::DBI::Cache ...;
34 </Perl>
35
36 package My::Class;
37 use base qw/Apache::DBI::Cache::ImaDBI Class::DBI/;
38
40 This module provides one method that is designed to override the way
41 Ima::DBI caches its DBI handle. Normally the handle is connected once
42 and saved in a closure. With Apache::DBI::Cache::ImaDBI the handle is
43 cached by means of Apache::DBI::Cache. Once per Apache request cycle if
44 a class is used for this request a handle is obtained from the cache.
45
46 This means:
47
48 • A classes DBI handle stays the same over an Apache request cycle
49 but may change between cycles.
50
51 • Multiple classes can use the same handle if used in different
52 request cylces.
53
54 • If multiple classes use the same database and these classes are
55 used in one request cycle then each class gets its own handle.
56
58 Normally your classes are designed to work not only with
59 Apache::DBI::Cache. Hence, your classes don't know also about
60 Apache::DBI::Cache::ImaDBI. But your classes inherit from Class::DBI
61 and Class::DBI inherits from Ima::DBI.
62
63 To get our special method called Apache::DBI::Cache::ImaDBI is used in
64 one of these ways:
65
66 use Apache::DBI::Cache::ImaDBI patch=>1;
67
68 or
69
70 use Apache::DBI::Cache::ImaDBI patch=>'Ima::DBI';
71
72 or
73
74 use Apache::DBI::Cache::ImaDBI patch=>'Class::DBI';
75
76 or
77
78 use Apache::DBI::Cache::ImaDBI patch=>qw[My::Class1 My::Class2];
79
80 The first 2 usages are exactly the same. Our special method is inserted
81 directly into Ima::DBI. Thus, all classes based on Ima::DBI inherit it.
82
83 The 3rd usage inserts our method into Class::DBI. Thus, all classes
84 based on it inherit our method but classes that are base directly on
85 Ima::DBI do not.
86
87 In the 4th case our method is inserted into individual classes only.
88
89 Another way to use Apache::DBI::Cache::ImaDBI is by inheriting from it:
90
91 package My::Class;
92 use base qw/Apache::DBI::Cache::ImaDBI Class::DBI/;
93
94 or
95
96 package My::Class;
97 use base qw/Apache::DBI::Cache::ImaDBI Ima::DBI/;
98
99 Here it is necessary that Apache::DBI::Cache::ImaDBI cames before
100 Class::DBI or Ima::DBI.
101
102 I think that is not the preferred way because it requires source code
103 modification of your classes.
104
106 Apache::DBI::Cache
107 Class::DBI
108 Ima::DBI
109
111 Torsten Foertsch, <torsten.foertsch@gmx.net>
112
114 Copyright (C) 2006 by Torsten Foertsch
115
116 This library is free software; you can redistribute it and/or modify it
117 under the same terms as Perl itself.
118
119
120
121perl v5.34.0 2021-07-22 Apache::DBI::Cache::ImaDBI(3)