SwayDB v0.3 released with TTL & update APIs

Hi all, I’ve just released SwayDB v0.3 with new APIs for auto expiring key-values (TTL), batching, range, update APIs & being fully asynchronous.

Here is a sample API on how expire and update APIs can be used.

//put & expire a key-value after a day
db.put(key = 1, value = "one", expireAfter = 1.day)
//or expire a range of key-values after an hour
db.expire(from = 1, to = 1000, after = 1.hour)
//update values without altering the already set expiration
db.update(from = 1, to = 1000, value = "value updated")
//or update a single value
db.update(key = 1, value = "value updated")
//fetch the expiration deadline for a key
db.expiration(key = 1)
//fetch time left until the key's expiration
db.timeLeft(key = 1)

All write APIs can also be batched to perform ACID like atomic operations. Here is a sample API

db.batch(
  Batch.Put(key = 1, value = "one value"),
  Batch.Put(key = 1, value = "one value", expireAfter = 10.seconds),
  Batch.Remove(key = 1),
  Batch.Remove(from = 1, to = 100),
  Batch.Expire(key = 1, after = 10.seconds),
  Batch.Expire(from = 1, to = 100, after = 1.day),
  Batch.Update(key = 1, value = "value updated"),
  Batch.Update(from = 1, to = 100, value = "range update")
)

I will really appreciate your feedback. Please try it out and let me know of anything.

Checkout SwayDB.examples to see working examples.

v0.4 will include major file compression improvements.

Thanks
Simer