helion3
helion3

Reputation: 37431

Best method to temporarily store/query data?

I have an application that stores information about user temporarily. I don't want to mess with mysql because it's overkill - I need to store an id, user name, and some additional fields. I need to be able to easily query by the id, show all, or pull a list per-user.

A hash map would work ok but seems inefficient when needing to pull a list based on conditions. I'm still fairly new to java, but not programming, is are there a better database system or something that would work better for my task?

Upvotes: 1

Views: 577

Answers (3)

dreampowder
dreampowder

Reputation: 1653

You can use Hibernate imo. I am using java play framework and it uses H2 as database engine. It can run db on memory just like a normal database Engine (both HQL and SQL), doesnt require any DB server to be installed and if you want, you can also store the data on a simple file format.

Upvotes: 0

ali haider
ali haider

Reputation: 20232

In-memory caches (without disk based stores) could be used - e.g. HazelCast/Redis/EHCache. HazelCast has maps, multimaps, sets, lists, queues & topics (similar features are available in other in-memory stores). You could also use in-memory database such as H2 etc. if you do not wish to use Java collections/in-memory caches.

Upvotes: 3

Sean Patrick Floyd
Sean Patrick Floyd

Reputation: 299048

You could use an in memory database like Apache Derby, that would give you the best of both worlds: direct integration into your app and the full power of a DB.

Upvotes: 2

Related Questions