|
51 | 51 | <cache type="org.mybatis.caches.memcached.MemcachedCache" />
|
52 | 52 | ...
|
53 | 53 | </mapper>]]></source>
|
54 |
| - <p>You can also provide values for parameters that can be modified dynamically at runtime:</p> |
55 |
| -<source><![CDATA[<mapper namespace="org.acme.FooMapper"> |
56 |
| - <cache type="org.mybatis.caches.memcached.MemcachedCache" /> |
57 |
| - <property name="timeToIdleSeconds" value="3600" /><!--1 hour--> |
58 |
| - <property name="timeToLiveSeconds" value="3600" /><!--1 hour--> |
59 |
| - <property name="maxEntriesLocalHeap" value="1000" /> |
60 |
| - <property name="maxEntriesLocalDisk" value="10000000" /> |
61 |
| - <property name="memoryStoreEvictionPolicy" value="LRU" /> |
62 |
| - </cache> |
63 |
| - ... |
64 |
| -</mapper>]]></source> |
| 54 | + |
| 55 | + <p>The Memcached cache is configurable by putting the |
| 56 | + <code>/memcached.properties</code> classpath resource; if not found, the client will |
| 57 | + use the default setting.</p> |
| 58 | + <p>The following table resumes the supported configurations params; each |
| 59 | + parameter is optional, if not found in the configuration, the client will use |
| 60 | + the default value:</p> |
| 61 | + |
| 62 | + <table> |
| 63 | + <tr> |
| 64 | + <th>Property</th> |
| 65 | + <th>Default</th> |
| 66 | + <th>Description</th> |
| 67 | + </tr> |
| 68 | + <tr> |
| 69 | + <td>org.mybatis.caches.memcached.keyprefix</td> |
| 70 | + <td><code>_mybatis_</code></td> |
| 71 | + <td>any string identifier</td> |
| 72 | + </tr> |
| 73 | + <tr> |
| 74 | + <td>org.mybatis.caches.memcached.servers</td> |
| 75 | + <td><code>localhost:11211</code></td> |
| 76 | + <td>space separated list of <code>${host}:${port}</code></td> |
| 77 | + </tr> |
| 78 | + <tr> |
| 79 | + <td>org.mybatis.caches.memcached.connectionfactory</td> |
| 80 | + <td><code>net.spy.memcached.DefaultConnectionFactory</code></td> |
| 81 | + <td>Any class that implements <code>net.spy.memcached.ConnectionFactory</code></td> |
| 82 | + </tr> |
| 83 | + <tr> |
| 84 | + <td>org.mybatis.caches.memcached.expiration</td> |
| 85 | + <td>the number of seconds in 30 days</td> |
| 86 | + <td>the expiration time (in seconds)</td> |
| 87 | + </tr> |
| 88 | + <tr> |
| 89 | + <td>org.mybatis.caches.memcached.asyncget</td> |
| 90 | + <td><code>false</code></td> |
| 91 | + <td>flag to enable/disable the async get</td> |
| 92 | + </tr> |
| 93 | + <tr> |
| 94 | + <td>org.mybatis.caches.memcached.timeout</td> |
| 95 | + <td><code>5</code></td> |
| 96 | + <td>the timeout when using async get</td> |
| 97 | + </tr> |
| 98 | + <tr> |
| 99 | + <td>org.mybatis.caches.memcached.timeoutunit</td> |
| 100 | + <td><code>java.util.concurrent.TimeUnit.SECONDS</code></td> |
| 101 | + <td>the timeout unit when using async get</td> |
| 102 | + </tr> |
| 103 | + <tr> |
| 104 | + <td>org.mybatis.caches.memcached.compression</td> |
| 105 | + <td><code>false</code></td> |
| 106 | + <td>if true, objects will be GZIP compressed before putting them to Memcached</td> |
| 107 | + </tr> |
| 108 | + </table> |
| 109 | + |
65 | 110 | <p>If users need to log cache operations, they can plug the Cache logging version:</p>
|
66 | 111 | <source><![CDATA[<mapper namespace="org.acme.FooMapper">
|
67 | 112 | <cache type="org.mybatis.caches.memcached.LoggingMemcachedCache" />
|
|
0 commit comments