use of org.apache.ignite.internal.processors.cache.GridCacheInternal in project ignite by apache.
the class GridCacheQueryManager method store.
/**
* Writes key-value pair to index.
*
* @param key Key.
* @param partId Partition.
* @param prevVal Previous value.
* @param prevVer Previous version.
* @param val Value.
* @param ver Cache entry version.
* @param expirationTime Expiration time or 0 if never expires.
* @param link Link.
* @throws IgniteCheckedException In case of error.
*/
public void store(KeyCacheObject key, int partId, @Nullable CacheObject prevVal, @Nullable GridCacheVersion prevVer, CacheObject val, GridCacheVersion ver, long expirationTime, long link) throws IgniteCheckedException {
assert key != null;
assert val != null;
assert enabled();
if (key instanceof GridCacheInternal)
// No-op.
return;
if (!enterBusy())
throw new NodeStoppingException("Operation has been cancelled (node is stopping).");
try {
if (isIndexingSpiEnabled()) {
CacheObjectContext coctx = cctx.cacheObjectContext();
Object key0 = unwrapIfNeeded(key, coctx);
Object val0 = unwrapIfNeeded(val, coctx);
cctx.kernalContext().indexing().store(cacheName, key0, val0, expirationTime);
}
if (qryProcEnabled)
qryProc.store(cacheName, key, partId, prevVal, prevVer, val, ver, expirationTime, link);
} finally {
invalidateResultCache();
leaveBusy();
}
}
use of org.apache.ignite.internal.processors.cache.GridCacheInternal in project ignite by apache.
the class GridCacheStoreManagerAdapter method remove.
/** {@inheritDoc} */
@Override
public final boolean remove(@Nullable IgniteInternalTx tx, KeyCacheObject key) throws IgniteCheckedException {
if (store != null) {
// Never remove internal key from store as it is never persisted.
if (key instanceof GridCacheInternal)
return false;
Object key0 = cctx.unwrapBinaryIfNeeded(key, !convertBinary());
if (log.isDebugEnabled())
log.debug(S.toString("Removing value from cache store", "key", key0, true));
sessionInit0(tx);
boolean threwEx = true;
try {
store.delete(key0);
threwEx = false;
} catch (ClassCastException e) {
handleClassCastException(e);
} catch (CacheWriterException e) {
throw new IgniteCheckedException(e);
} catch (Exception e) {
throw new IgniteCheckedException(new CacheWriterException(e));
} finally {
sessionEnd0(tx, threwEx);
}
if (log.isDebugEnabled())
log.debug(S.toString("Removed value from cache store", "key", key0, true));
return true;
}
return false;
}
Aggregations