Overview: We are using Cassandra to store cache in our application.we have table itinerary having a (partition key, cluster key 1, cluster key 2) Primary key and payload column. The current implementation has CacheService[T: Key]
which has 3 methods get, update, delete. We have ItineraryService[T: Key]
which is implementing these 3 methods. In current get method implementation, we are getting data by using partition key only. This CacheService is also implemented by other services.
Problem: The problem is sometimes we need data by cluster key 1 or cluster key 2. Now we have only one itinerary service we can't change the implementation.
Solution: The solution that I have in my mind will create one more abstraction layer and there I will create method getByClusterKey1 and getByClusterKey2. I can't do in ItineraryCache Service as I explained CacheService is implemented by other services also.
Expected Solution: I wants to pass some Map[Key, ColumenName]. If I can fetch the data in Cassandra directly I will build query accordingly otherwise I will get all data and then will filter. I know about query order so I will check up to which cluster key I can build a query and then leave others and filter out later.
Please suggest me something if you guys already build something like this. I want to build a loosely coupled design.
Aucun commentaire:
Enregistrer un commentaire