1 package org.apache.jcs.auxiliary.disk.jdbc.mysql;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheAttributes;
23
24 /***
25 * This has additional attributes that are particular to the MySQL disk cache.
26 * <p>
27 * @author Aaron Smuts
28 */
29 public class MySQLDiskCacheAttributes
30 extends JDBCDiskCacheAttributes
31 {
32 private static final long serialVersionUID = -6535808344813320061L;
33
34 /***
35 * For now this is a simple comma delimited list of HH:MM:SS times to optimize
36 * the table. If none is supplied, then no optimizations will be performed.
37 * <p>
38 * In the future we can add a chron like scheduling system. This is to meet
39 * a pressing current need.
40 * <p>
41 * 03:01,15:00 will cause the optimizer to run at 3 am and at 3 pm.
42 */
43 private String optimizationSchedule = null;
44
45 /***
46 * If true, we will balk, that is return null during optimization rather than block.
47 */
48 public static final boolean DEFAULT_BALK_DURING_OPTIMIZATION = true;
49
50 /***
51 * If true, we will balk, that is return null during optimization rather than block.
52 * <p>
53 * <a href="http://en.wikipedia.org/wiki/Balking_pattern">Balking</a>
54 */
55 private boolean balkDuringOptimization = DEFAULT_BALK_DURING_OPTIMIZATION;
56
57 /***
58 * @param optimizationSchedule The optimizationSchedule to set.
59 */
60 public void setOptimizationSchedule( String optimizationSchedule )
61 {
62 this.optimizationSchedule = optimizationSchedule;
63 }
64
65 /***
66 * @return Returns the optimizationSchedule.
67 */
68 public String getOptimizationSchedule()
69 {
70 return optimizationSchedule;
71 }
72
73 /***
74 * @param balkDuringOptimization The balkDuringOptimization to set.
75 */
76 public void setBalkDuringOptimization( boolean balkDuringOptimization )
77 {
78 this.balkDuringOptimization = balkDuringOptimization;
79 }
80
81 /***
82 * Should we return null while optimizing the table.
83 * <p>
84 * @return Returns the balkDuringOptimization.
85 */
86 public boolean isBalkDuringOptimization()
87 {
88 return balkDuringOptimization;
89 }
90
91 /***
92 * For debugging.
93 */
94 public String toString()
95 {
96 StringBuffer buf = new StringBuffer();
97 buf.append( "\nMySQLDiskCacheAttributes" );
98 buf.append( "\n OptimizationSchedule [" + getOptimizationSchedule() + "]" );
99 buf.append( "\n BalkDuringOptimization [" + isBalkDuringOptimization() + "]" );
100 buf.append( super.toString() );
101 return buf.toString();
102 }
103 }