Class CacheJdbcBlobStore<K,​V>

    • Field Detail

      • DFLT_CONN_URL

        public static final String DFLT_CONN_URL
        Default connection URL (value is jdbc:h2:mem:jdbcCacheStore;DB_CLOSE_DELAY=-1).
        See Also:
        Constant Field Values
      • DFLT_CREATE_TBL_QRY

        public static final String DFLT_CREATE_TBL_QRY
        Default create table query (value is create table if not exists ENTRIES (akey binary primary key, val binary)).
        See Also:
        Constant Field Values
      • DFLT_LOAD_QRY

        public static final String DFLT_LOAD_QRY
        Default load entry query (value is select * from ENTRIES where akey=?).
        See Also:
        Constant Field Values
      • DFLT_UPDATE_QRY

        public static final String DFLT_UPDATE_QRY
        Default update entry query (value is select * from ENTRIES where akey=?).
        See Also:
        Constant Field Values
      • DFLT_INSERT_QRY

        public static final String DFLT_INSERT_QRY
        Default insert entry query (value is insert into ENTRIES (akey, val) values (?, ?)).
        See Also:
        Constant Field Values
      • DFLT_DEL_QRY

        public static final String DFLT_DEL_QRY
        Default delete entry query (value is delete from ENTRIES where akey=?).
        See Also:
        Constant Field Values
    • Constructor Detail

      • CacheJdbcBlobStore

        public CacheJdbcBlobStore()
    • Method Detail

      • sessionEnd

        public void sessionEnd​(boolean commit)
        Default empty implementation for ending transactions. Note that if explicit cache transactions are not used, then transactions do not have to be explicitly ended - for all other cases this method should be overridden with custom commit/rollback logic.
        Specified by:
        sessionEnd in interface CacheStore<K,​V>
        Overrides:
        sessionEnd in class CacheStoreAdapter<K,​V>
        Parameters:
        commit - True if transaction should commit, false for rollback.
      • load

        public V load​(K key)
      • write

        public void write​(javax.cache.Cache.Entry<? extends K,​? extends V> entry)
      • delete

        public void delete​(Object key)
      • setInitSchema

        public void setInitSchema​(boolean initSchema)
        Flag indicating whether DB schema should be initialized by Ignite (default behaviour) or was explicitly created by user.
        Parameters:
        initSchema - True if DB schema should be initialized by Ignite (default behaviour), {code @false} if schema was explicitly created by user.
      • setConnectionUrl

        public void setConnectionUrl​(String connUrl)
        Sets connection URL.
        Parameters:
        connUrl - Connection URL.
      • setCreateTableQuery

        public void setCreateTableQuery​(String createTblQry)
        Sets create table query.
        Parameters:
        createTblQry - Create table query.
      • setLoadQuery

        public void setLoadQuery​(String loadQry)
        Sets load query.
        Parameters:
        loadQry - Load query
      • setUpdateQuery

        public void setUpdateQuery​(String updateQry)
        Sets update entry query.
        Parameters:
        updateQry - Update entry query.
      • setInsertQuery

        public void setInsertQuery​(String insertQry)
        Sets insert entry query.
        Parameters:
        insertQry - Insert entry query.
      • setDeleteQuery

        public void setDeleteQuery​(String delQry)
        Sets delete entry query.
        Parameters:
        delQry - Delete entry query.
      • setUser

        public void setUser​(String user)
        Sets user name for database access.
        Parameters:
        user - User name.
      • setPassword

        public void setPassword​(String passwd)
        Sets password for database access.
        Parameters:
        passwd - Password.
      • setDataSource

        public void setDataSource​(DataSource dataSrc)
        Sets data source. Data source should be fully configured and ready-to-use.

        Note that if data source is provided, all connections will be acquired via this data source. If data source is not provided, a new connection will be created for each store call (connectionUrl, user and password parameters will be used).

        Parameters:
        dataSrc - Data source.
      • toBytes

        protected byte[] toBytes​(Object obj)
                          throws IgniteCheckedException
        Serialize object to byte array using marshaller.
        Parameters:
        obj - Object to convert to byte array.
        Returns:
        Byte array.
        Throws:
        IgniteCheckedException - If failed to convert.
      • fromBytes

        protected <X> X fromBytes​(byte[] bytes)
                           throws IgniteCheckedException
        Deserialize object from byte array using marshaller.
        Type Parameters:
        X - Result object type.
        Parameters:
        bytes - Bytes to deserialize.
        Returns:
        Deserialized object.
        Throws:
        IgniteCheckedException - If failed.