Ramesh Babu
Ramesh Babu

Reputation: 11

writing java Cache Manager with Search functionality

I want to create a cache module, which can store data coming from different tables. I also require search on these data.

Cache needs to store below kind of data in either map/list, and then search has to happen on country and capacity.

public class CumulativeCapacity {

private  String region;
private  String country;
private  int capacity;
private  int storeSum;
}

The search functionality is like, we have to check objects country is in the list [US, CAN, UK etc..] and capacity withing range1 and range2

as of now i created simple Cache Manager which is having list/map of these objects, and i am planning to use predicate to do the search.

any better logic using plain java classes?

Upvotes: 1

Views: 172

Answers (1)

卢声远 Shengyuan Lu
卢声远 Shengyuan Lu

Reputation: 32014

1: You could use cache open source libraries.

2: If you need to write yourself, some of my idea:

  • Hash based container is better than others, as they are fast. Performance is cache’s only value.
  • Concurrency is a large concern in cache module, you could use classes in java.util.concurrent.

Upvotes: 1

Related Questions