简体   繁体   中英

Caching YAML file

I've been wanting to cache my YML file that I use to access messages, it is used a lot and has a lot of stuff in it, so caching would make it a lot better in terms of performance.

I was wondering if there is a way to run through every path in the file and turn it into a HashMap, like HashMap where one String would be the path and the other the value.

Is it possible to do it automatically or would I need to set it one by one based on my setup?

The way I have the file is:

messages:
  test:
    test1: "message"
  test-this:
    test2: "message"

Look's like you need to use one of YAML de/serializers. Parse the file, convert it to object if needed, then you can easily cache the content anywhere you'd prefer.

A few common libraries:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM