How to compress memory cache?

Hello, I have data in text file I want the this data cache in memory. It’s okay I use this library.

This process consumes a lot of memory. My text file is 1.5GB in memory 8GB (Linux) 7GB(Windows) How can I compress this data or reduce memory consumption?

Why do you need it in memory?

there are 80 million lines in the data file, I want to store this data in memory instead of storing it in a database (performance, speed and most importantly cost)

I would store the file on disk but on a SSD drive to achieve a better performance.