⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 performance.pot

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 POT
📖 第 1 页 / 共 4 页
字号:
#, no-c-formatmsgid "SwarmCache"msgstr ""#. Tag: literal#: performance.xml:656#, no-c-formatmsgid "org.hibernate.cache.SwarmCacheProvider"msgstr ""#. Tag: entry#: performance.xml:657#, no-c-formatmsgid "clustered (ip multicast)"msgstr ""#. Tag: entry#: performance.xml:658#, no-c-formatmsgid "yes (clustered invalidation)"msgstr ""#. Tag: entry#: performance.xml:662 performance.xml:850#, no-c-formatmsgid "JBoss Cache 1.x"msgstr ""#. Tag: literal#: performance.xml:663#, no-c-formatmsgid "org.hibernate.cache.TreeCacheProvider"msgstr ""#. Tag: entry#: performance.xml:664 performance.xml:671#, no-c-formatmsgid "clustered (ip multicast), transactional"msgstr ""#. Tag: entry#: performance.xml:665#, no-c-formatmsgid "yes (replication)"msgstr ""#. Tag: entry#: performance.xml:666 performance.xml:673#, no-c-formatmsgid "yes (clock sync req.)"msgstr ""#. Tag: entry#: performance.xml:669 performance.xml:857#, no-c-formatmsgid "JBoss Cache 2"msgstr ""#. Tag: literal#: performance.xml:670#, no-c-formatmsgid "org.hibernate.cache.jbc2.JBossCacheRegionFactory"msgstr ""#. Tag: entry#: performance.xml:672#, no-c-formatmsgid "yes (replication or invalidation)"msgstr ""#. Tag: title#: performance.xml:680#, no-c-formatmsgid "Cache mappings"msgstr ""#. Tag: para#: performance.xml:682#, no-c-formatmsgid "The <literal>&lt;cache&gt;</literal> element of a class or collection mapping has the following form:"msgstr ""#. Tag: programlisting#: performance.xml:693#, no-c-formatmsgid ""      "<![CDATA[<cache \n"      "    usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n"      "    region=\"RegionName\"\n"      "    include=\"all|non-lazy\"\n"      "/>]]>"msgstr ""#. Tag: para#: performance.xml:696#, no-c-formatmsgid "<literal>usage</literal> (required) specifies the caching strategy: <literal>transactional</literal>, <literal>read-write</literal>, <literal>nonstrict-read-write</literal> or <literal>read-only</literal>"msgstr ""#. Tag: para#: performance.xml:705#, no-c-formatmsgid "<literal>region</literal> (optional, defaults to the class or collection role name) specifies the name of the second level cache region"msgstr ""#. Tag: para#: performance.xml:712#, no-c-formatmsgid "<literal>include</literal> (optional, defaults to <literal>all</literal>) <literal>non-lazy</literal> specifies that properties of the entity mapped with <literal>lazy=\"true\"</literal> may not be cached when attribute-level lazy fetching is enabled"msgstr ""#. Tag: para#: performance.xml:722#, no-c-formatmsgid "Alternatively (preferably?), you may specify <literal>&lt;class-cache&gt;</literal> and <literal>&lt;collection-cache&gt;</literal> elements in <literal>hibernate.cfg.xml</literal>."msgstr ""#. Tag: para#: performance.xml:727#, no-c-formatmsgid "The <literal>usage</literal> attribute specifies a <emphasis>cache concurrency strategy</emphasis>."msgstr ""#. Tag: title#: performance.xml:734#, no-c-formatmsgid "Strategy: read only"msgstr ""#. Tag: para#: performance.xml:736#, no-c-formatmsgid "If your application needs to read but never modify instances of a persistent class, a <literal>read-only</literal> cache may be used. This is the simplest and best performing strategy. It's even perfectly safe for use in a cluster."msgstr ""#. Tag: programlisting#: performance.xml:742#, no-c-formatmsgid ""      "<![CDATA[<class name=\"eg.Immutable\" mutable=\"false\">\n"      "    <cache usage=\"read-only\"/>\n"      "    ....\n"      "</class>]]>"msgstr ""#. Tag: title#: performance.xml:748#, no-c-formatmsgid "Strategy: read/write"msgstr ""#. Tag: para#: performance.xml:750#, no-c-formatmsgid "If the application needs to update data, a <literal>read-write</literal> cache might be appropriate. This cache strategy should never be used if serializable transaction isolation level is required. If the cache is used in a JTA environment, you must specify the property <literal>hibernate.transaction.manager_lookup_class</literal>, naming a strategy for obtaining the JTA <literal>TransactionManager</literal>. In other environments, you should ensure that the transaction is completed when <literal>Session.close()</literal> or <literal>Session.disconnect()</literal> is called. If you wish to use this strategy in a cluster, you should ensure that the underlying cache implementation supports locking. The built-in cache providers do <emphasis>not</emphasis>."msgstr ""#. Tag: programlisting#: performance.xml:761#, no-c-formatmsgid ""      "<![CDATA[<class name=\"eg.Cat\" .... >\n"      "    <cache usage=\"read-write\"/>\n"      "    ....\n"      "    <set name=\"kittens\" ... >\n"      "        <cache usage=\"read-write\"/>\n"      "        ....\n"      "    </set>\n"      "</class>]]>"msgstr ""#. Tag: title#: performance.xml:766#, no-c-formatmsgid "Strategy: nonstrict read/write"msgstr ""#. Tag: para#: performance.xml:768#, no-c-formatmsgid "If the application only occasionally needs to update data (ie. if it is extremely unlikely that two transactions would try to update the same item simultaneously) and strict transaction isolation is not required, a <literal>nonstrict-read-write</literal> cache might be appropriate. If the cache is used in a JTA environment, you must specify <literal>hibernate.transaction.manager_lookup_class</literal>. In other environments, you should ensure that the transaction is completed when <literal>Session.close()</literal> or <literal>Session.disconnect()</literal> is called."msgstr ""#. Tag: title#: performance.xml:780#, no-c-formatmsgid "Strategy: transactional"msgstr ""#. Tag: para#: performance.xml:782#, no-c-formatmsgid "The <literal>transactional</literal> cache strategy provides support for fully transactional cache providers such as JBoss TreeCache. Such a cache may only be used in a JTA environment and you must specify <literal>hibernate.transaction.manager_lookup_class</literal>."msgstr ""#. Tag: title#: performance.xml:791#, no-c-formatmsgid "Cache-provider/concurrency-strategy compatibility"msgstr ""#. Tag: para#: performance.xml:794#, no-c-formatmsgid "None of the cache providers support all of the cache concurrency strategies."msgstr ""#. Tag: para#: performance.xml:799#, no-c-formatmsgid "The following table shows which providers are compatible with which concurrency strategies."msgstr ""#. Tag: title#: performance.xml:804#, no-c-formatmsgid "Cache Concurrency Strategy Support"msgstr ""#. Tag: entry#: performance.xml:814#, no-c-formatmsgid "read-only"msgstr ""#. Tag: entry#: performance.xml:815#, no-c-formatmsgid "nonstrict-read-write"msgstr ""#. Tag: entry#: performance.xml:816#, no-c-formatmsgid "read-write"msgstr ""#. Tag: entry#: performance.xml:817#, no-c-formatmsgid "transactional"msgstr ""#. Tag: title#: performance.xml:872#, no-c-formatmsgid "Managing the caches"msgstr ""#. Tag: para#: performance.xml:874#, no-c-formatmsgid "Whenever you pass an object to <literal>save()</literal>, <literal>update()</literal> or <literal>saveOrUpdate()</literal> and whenever you retrieve an object using <literal>load()</literal>, <literal>get()</literal>, <literal>list()</literal>, <literal>iterate()</literal> or <literal>scroll()</literal>, that object is added to the internal cache of the <literal>Session</literal>."msgstr ""#. Tag: para#: performance.xml:881#, no-c-formatmsgid "When <literal>flush()</literal> is subsequently called, the state of that object will be synchronized with the database. If you do not want this synchronization to occur or if you are processing a huge number of objects and need to manage memory efficiently, the <literal>evict()</literal> method may be used to remove the object and its collections from the first-level cache."msgstr ""#. Tag: programlisting#: performance.xml:889#, no-c-formatmsgid ""      "<![CDATA[ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //a huge result set\n"      "while ( cats.next() ) {\n"      "    Cat cat = (Cat) cats.get(0);\n"      "    doSomethingWithACat(cat);\n"      "    sess.evict(cat);\n"      "}]]>"msgstr ""#. Tag: para#: performance.xml:891#, no-c-formatmsgid "The <literal>Session</literal> also provides a <literal>contains()</literal> method to determine if an instance belongs to the session cache."msgstr ""#. Tag: para#: performance.xml:896#, no-c-formatmsgid "To completely evict all objects from the session cache, call <literal>Session.clear()</literal>"msgstr ""#. Tag: para#: performance.xml:900#, no-c-formatmsgid "For the second-level cache, there are methods defined on <literal>SessionFactory</literal> for evicting the cached state of an instance, entire class, collection instance or entire collection role."msgstr ""#. Tag: programlisting#: performance.xml:906#, no-c-formatmsgid ""      "<![CDATA[sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n"      "sessionFactory.evict(Cat.class);  //evict all Cats\n"      "sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a particular collection of kittens\n"      "sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten collections]]>"msgstr ""#. Tag: para#: performance.xml:908#, no-c-formatmsgid "The <literal>CacheMode</literal> controls how a particular session interacts with the second-level cache."msgstr ""#. Tag: para#: performance.xml:915#, no-c-formatmsgid "<literal>CacheMode.NORMAL</literal> - read items from and write items to the second-level cache"msgstr ""#. Tag: para#: performance.xml:920#, no-c-formatmsgid "<literal>CacheMode.GET</literal> - read items from the second-level cache, but don't write to the second-level cache except when updating data"msgstr ""#. Tag: para#: performance.xml:926#, no-c-formatmsgid "<literal>CacheMode.PUT</literal> - write items to the second-level cache, but don't read from the second-level cache"msgstr ""#. Tag: para#: performance.xml:932#, no-c-formatmsgid "<literal>CacheMode.REFRESH</literal> - write items to the second-level cache, but don't read from the second-level cache, bypass the effect of <literal>hibernate.cache.use_minimal_puts</literal>, forcing a refresh of the second-level cache for all items read from the database"msgstr ""#. Tag: para#: performance.xml:940#, no-c-formatmsgid "To browse the contents of a second-level or query cache region, use the <literal>Statistics</literal> API:"msgstr ""#. Tag: programlisting#: performance.xml:945#, no-c-formatmsgid ""      "<![CDATA[Map cacheEntries = sessionFactory.getStatistics()\n"      "        .getSecondLevelCacheStatistics(regionName)\n"      "        .getEntries();]]>"msgstr ""#. Tag: para#: performance.xml:947#, no-c-formatmsgid "You'll need to enable statistics, and, optionally, force Hibernate to keep the cache entries in a more human-understandable format:"msgstr ""#. Tag: programlisting#: performance.xml:952#, no-c-formatmsgid ""      "<![CDATA[hibernate.generate_statistics true\n"      "hibernate.cache.use_structured_entries true]]>"msgstr ""#. Tag: title#: performance.xml:957#, no-c-formatmsgid "The Query Cache"msgstr ""#. Tag: para#: performance.xml:959#, no-c-formatmsgid "Query result sets may also be cached. This is only useful for queries that are run frequently with the same parameters. To use the query cache you must first enable it:"msgstr ""#. Tag: programlisting#: performance.xml:964#, no-c-formatmsgid "<![CDATA[hibernate.cache.use_query_cache true]]>"msgstr ""#. Tag: para#: performance.xml:966#, no-c-formatmsgid "This setting causes the creation of two new cache regions - one holding cached query result sets (<literal>org.hibernate.cache.StandardQueryCache</literal>), the other holding timestamps of the most recent updates to queryable tables (<literal>org.hibernate.cache.UpdateTimestampsCache</literal>). Note that the query cache does not cache the state of the actual entities in the result set; it caches only identifier values and results of value type. So the query cache should always be used in conjunction with the second-level cache."msgstr ""#. Tag: para#: performance.xml:976#, no-c-formatmsgid "Most queries do not benefit from caching, so by default queries are not cached. To enable caching, call <literal>Query.setCacheable(true)</literal>. This call allows the query to look for existing cache results or add its results to the cache when it is executed."msgstr ""

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -