long notifyDeleted(int[] deleted, List<ObjectId> ids, BulkOpListener listener) { long count = 0; for (int i = 0; i < deleted.length; i++) { ObjectId id = ids.get(i); sharedCache.invalidate(id); if (deleted[i] > 0) { count++; listener.deleted(id); } else { listener.notFound(id); } } return count; }
long notifyDeleted(int[] deleted, List<ObjectId> ids, BulkOpListener listener) { long count = 0; for (int i = 0; i < deleted.length; i++) { ObjectId id = ids.get(i); sharedCache.invalidate(id); if (deleted[i] > 0) { count++; listener.deleted(id); } else { listener.notFound(id); } } return count; }
/** * Deletes the object with the specified id. * * @return Flag indicating if object was actually removed. */ private void delete(final ObjectId id, DataSource ds) { String sql = format("DELETE FROM %s WHERE id = CAST(ROW(?,?,?) AS OBJECTID)", objectsTable()); try (Connection cx = PGStorage.newConnection(ds)) { cx.setAutoCommit(true); try (PreparedStatement stmt = cx.prepareStatement(log(sql, LOG, id))) { PGId.valueOf(id).setArgs(stmt, 1); stmt.executeUpdate(); sharedCache.invalidate(id); } } catch (SQLException e) { throw propagate(e); } }
/** * Deletes the object with the specified id. * * @return Flag indicating if object was actually removed. */ private void delete(final ObjectId id, DataSource ds) { String sql = format("DELETE FROM %s WHERE id = CAST(ROW(?,?,?) AS OBJECTID)", objectsTable()); try (Connection cx = PGStorage.newConnection(ds)) { cx.setAutoCommit(true); try (PreparedStatement stmt = cx.prepareStatement(log(sql, LOG, id))) { PGId.valueOf(id).setArgs(stmt, 1); stmt.executeUpdate(); sharedCache.invalidate(id); } } catch (SQLException e) { throw new RuntimeException(e); } }
public @Test void testInvalidate() { cache2.invalidate(o2.getId()); cache1.invalidate(o1.getId()); verify(mockSharedCache, times(1)).invalidate(eq(k22)); verify(mockSharedCache, times(1)).invalidate(eq(k11)); verifyNoMoreInteractions(mockSharedCache); }
public @Test void testInvalidate() { cache2.invalidate(o2.getId()); cache1.invalidate(o1.getId()); verify(mockSharedCache, times(1)).invalidate(eq(k22)); verify(mockSharedCache, times(1)).invalidate(eq(k11)); verifyNoMoreInteractions(mockSharedCache); }