2 Replies Latest reply on Mar 20, 2018 3:40 AM by Jean-Pierre RIO

    Web session in jdbc store not deleted

    Jean-Pierre RIO Newbie


      We're using WF10 and we'd like to use this configuration for our web cache :


      <cache-container name="web" default-cache="jdbc" module="org.wildfly.clustering.web.infinispan">
                          <transport lock-timeout="60000"/>
                          <local-cache name="concurrent">
                              <file-store passivation="true" purge="false"/>
                          <invalidation-cache name="jdbc">
                              <transaction mode="BATCH"/>
                              <binary-keyed-jdbc-store data-source="H2DS" fetch-state="false" passivation="false" preload="false" purge="false" shared="true" singleton="false">
                                  <property name="databaseType">
                                  <property name="createTableOnStart">
                                  <binary-keyed-table prefix="SESSIONS">
                                      <id-column name="id" type="VARCHAR"/>
                                      <data-column name="datum" type="BINARY"/>
                                      <timestamp-column name="version" type="BIGINT"/>


      We can see our sessions persisted in the store, but they are never deleted from the db when expired. Is there anything wrong in my configuration ?



        • 1. Re: Web session in jdbc store not deleted
          Paul Ferraro Master

          There is nothing specifically wrong with your configuration, though your id-column really ought to be a numeric type.  Additionally, you can replace your "databaseType" property with the attribute: dialect="H2".

          Web sessions are indeed deleted from the database on expiration.  It's a common misconception that the binary-keyed-jdbc-store stores a database record per session.  This is not the case.  This cache store implementation stores a database record for each hash bucket, where the cache entries of a given bucket are stored within the "datum" field.  When a web session expires, this triggers an update of this record, not a deletion.


          I strongly encourage you to update to WF11, whose jdbc-store implementation maps each cache entry to a separate database record.  This is far more efficient than the binary-keyed-jdbc-store.

          • 2. Re: Web session in jdbc store not deleted
            Jean-Pierre RIO Newbie

            Thank you Paul for the explanation. I just tested with WF11 and it works as you said : one row per session, deleted at expiration.