Is it duplicated if I cache an object that uses data from postmeta?

If the generation of the graphic presentation requires a lot of CPU time or memory, then yes, you could cache your graphic presentation (HTML I guess, right?). Perhaps in the database/memory, as a transient.

Caching post meta data (that you use to generate the graphic) is not necessary, because WP already handles this. If you do it too, then the same data will get stored twice in memory. But keep in mind that by default WP’s cache is not persistent, so the cache gets flushed after script finishes execution (on each page load). There are plugins out there that implement persistent object caching, if you need it.


Summary:

  • you don’t cache results from post queries made with wrapper functions like get_posts(), get_post_meta() etc ; WP does already that internally.
  • you cache your own data, like your graphic, when the operation necessary to build it is more expensive than the cache query that would run to get that graphic; but:

    • if the operation is less expensive than a typical database select query from WP’s options table, then you use WP’s object cache API

    • if it’s more expensive than such queries, you use the Transient API, which will store your data in the database, but only if a memory caching interface is not available. Otherwise it will make use of the object cache.

Regardless of all the above, if you can use a persistent object caching plugin (example), do it! Because accessing the memory will always be faster than querying a database, which is typically a file on a disk, and disks are slow.