0

Is there any way to cache one entry against two keys in apache ignite? say for eg: I need to cache users, based on their user id and their username, so I can get it back in both ways. Which is the best way to achieve this?

1 Answers1

1
  1. Use two caches, from Id to User (ICache<Guid, User>) and from UserName to Id ICache<string, Guid>

  2. Use one cache ICache<Guid, User>, and create an SQL index on UserName column https://ignite.apache.org/docs/latest/SQL/indexes

Pavel Tupitsyn
  • 8,393
  • 3
  • 22
  • 44
  • Thanks for the quick response, Is it possible to perform SQL-like queries in Apache Ignite without a database? – netcoredev6 Sep 17 '21 at 07:29
  • 1
    Yes, Ignite IS the database with SQL capabilities, please see the docs (link in the answer) and example: https://github.com/apache/ignite/blob/master/modules/platforms/dotnet/examples/Thick/Sql/Sql/Program.cs – Pavel Tupitsyn Sep 17 '21 at 09:32