There is no explicit lock/unlock API. To get the effect you want you should use a transaction; a RL will be acquired on the get() call; WL for the put/remove. Locks will be retained until the tx commits or rolls back. If for some reason the calling thread hangs, eventually the tx will time out adn the transaction manager will roll it back, releasing the locks.
Please note though that a call to exists() does not acquire any lock.