Skip to content

Commit

Permalink
[26850] fix atc old cache query before remove, and set cache date
Browse files Browse the repository at this point in the history
  • Loading branch information
huthomas committed Jan 8, 2025
1 parent 587b338 commit 0b2adf8
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ public HashMap<String, Integer> rebuildCache(IElexisEntityManager elexisEntityMa
cache.put(atcCode.atcCode, foundElements);
monitor.worked(1);
}
monitor.subTask("Persisting ATC Code product cache to database");
monitor.subTask("Persisting ATC Code product cache to database"); //$NON-NLS-1$
// clear old caches
IQuery<IBlobSecondary> query = CoreModelServiceHolder.get().getQuery(IBlobSecondary.class);
query.and("id", COMPARATOR.LIKE, NAMED_BLOB_PREFIX + "%"); //$NON-NLS-1$ //$NON-NLS-2$
query.and(ModelPackage.Literals.IBLOB__DATE, COMPARATOR.LESS, LocalDate.now());
for (IBlobSecondary oldCache : query.execute()) {
CoreModelServiceHolder.get().remove(oldCache);
Expand All @@ -90,6 +91,7 @@ public HashMap<String, Integer> rebuildCache(IElexisEntityManager elexisEntityMa
if (cacheStorage == null) {
cacheStorage = CoreModelServiceHolder.get().create(IBlobSecondary.class);
cacheStorage.setId(determineBlobId(elexisEntityManager));
cacheStorage.setDate(LocalDate.now());
}
ByteArrayOutputStream ba = new ByteArrayOutputStream();
ObjectOutputStream oba = new ObjectOutputStream(ba);
Expand Down

0 comments on commit 0b2adf8

Please sign in to comment.