//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)
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.