ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nattapon <wrong...@gmail.com>
Subject Re: Does IgniteCache.containsKey lock the key in a Transaction?
Date Mon, 19 Aug 2019 07:00:05 GMT
Hi Yohan,

There is IgniteCache.lock(key) method described in
https://apacheignite.readme.io/docs/distributed-locks . Is it suited your
requirement?

IgniteCache<String, Integer> cache = ignite.cache("myCache");

// Create a lock for the given key
Lock lock = cache.lock("keyLock");
try {
    // Acquire the lock
    lock.lock();

    cache.put("Hello", 11);
    cache.put("World", 22);
}
finally {
    // Release the lock
    lock.unlock();
}

Regards,
Nattapon

On Fri, Aug 16, 2019 at 5:23 PM Yohan Fernando <Yohan.Fernando@tudor.com>
wrote:

> Hi All, Does  IgniteCache.containsKey() lock the key in a Transaction
> similar to IgniteCache.get() ? Basically I want a lightweight call to lock
> the key without having to Serialize objects from each node within a
> Transaction.
>
>
>
>
>
> _________________________________________________________
>
> This email, its contents, and any attachments transmitted with it are
> intended only for the addressee(s) and may be confidential and legally
> privileged. We do not waive any confidentiality by misdelivery. If you have
> received this email in error, please notify the sender immediately and
> delete it. You should not copy it, forward it or otherwise use the
> contents, attachments or information in any way. Any liability for viruses
> is excluded to the fullest extent permitted by law.
>
> Tudor Capital Europe LLP (TCE) is authorised and regulated by The
> Financial Conduct Authority (the FCA). TCE is registered as a limited
> liability partnership in England and Wales No: OC340673 with its registered
> office at 10 New Burlington Street, London, W1S 3BE, United Kingdom
>

Mime
View raw message