Starts a task to call commit() on this SQLHelper every n ticks. Pass -1 to disable. Automatically sets autoCommit to false. @param ticks The number of ticks between commits, or -1 to disable
(int ticks)
| 442 | * @param ticks The number of ticks between commits, or -1 to disable |
| 443 | */ |
| 444 | public void setCommitInterval(int ticks) { |
| 445 | if (commitTask != null) { |
| 446 | commitTask.cancel(); |
| 447 | commitTask = null; |
| 448 | } |
| 449 | if (ticks == -1) { |
| 450 | return; |
| 451 | } |
| 452 | setAutoCommit(false); |
| 453 | commitTask = Task.syncRepeating(RedLib.getInstance(), this::commit, ticks, ticks); |
| 454 | } |
| 455 | |
| 456 | /** |
| 457 | * Flushes all caches and commits the transaction |
no test coverage detected