MCPcopy Create free account
hub / github.com/boxbeam/RedLib / flush

Method flush

src/redempt/redlib/sql/SQLCache.java:190–201  ·  view source on GitHub ↗

Flushes the cache, saving all changes that were made.

()

Source from the content-addressed store, hash-verified

188 * Flushes the cache, saving all changes that were made.
189 */
190 public synchronized void flush() {
191 modified.forEach(s -> {
192 Object val = cache.get(s);
193 Object[] objs = new Object[s.getParams().length + 1];
194 objs[0] = val;
195 for (int i = 0; i < s.getParams().length; i++) {
196 objs[i + 1] = s.getParams()[i];
197 }
198 sql.execute(updateQuery, objs);
199 });
200 modified.clear();
201 }
202
203 /**
204 * Flushes a single value from the cache, saving changes that were made to it

Callers 2

flushMatchingCachesMethod · 0.80

Calls 6

getParamsMethod · 0.95
forEachMethod · 0.80
executeMethod · 0.80
getMethod · 0.65
removeMethod · 0.65
clearMethod · 0.45

Tested by

no test coverage detected