Documentation/examples for concurrent_lru_cache?

Documentation/examples for concurrent_lru_cache?

Hi, can someone point me to some examples and/or documentation for concurrent_lru_cache? I just see some vague mention of it being a new preview feature but it's a bit hard to understand how to use it just from the header file. Thanks!

9 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Quoting e4lamHi, can someone point me to some examples and/or documentation for concurrent_lru_cache? I just see some vague mention of it being a new preview feature but it's a bit hard to understand how to use it just from the header file. Thanks!

What TBB version are you using?I just searched TBB v4.0 sources installed on my computer with
'concurrent_lru_cache' expression and I haven't found anything.

Best regards,
Sergey

It should be in reference.pdf of TBB 4.0 update 2, in CPF section. We'll check it in OSS site and update ifnecessary.Any feedback on this CPF is appreciatedThanks!Vladimir

@Sergey: As mentioned, it can be found in the sources for TBB 4 update 2. The corresponding commercially aligned OSS version is tbb40_278oss

You're right, docs are up-to date and lru cache info is missed there.it should be available in the reference in next update in a few weeks.Meanwhile we are working to putting something lru cache related to the web.stay tuned:)--Vladimir

Best Reply

I've updated reference.pdf on the site.--Vladimir

Thanks for the update, Vladimir!

I've got some questions for you after reviewing the documentation.

- Has there been any changes to concurrent_lru_cache in the new TBB 4 Update 3? Can I simply try it out in TBB 4 Update 2?

- Will operator[]() block when adding a new cache item while all pre-existing items are already in use?

- How do you recommend using it efficiently for large value_type's given that value_functor_type returns the cache item by value? I'm not using C++11 yet so move operators are out of the question.

Thanks!

e4lam,
see bellow:

- Has there been any changes to concurrent_lru_cache in the
new TBB 4 Update 3? Can I simply try it out in TBB 4 Update 2?
-- Yes, there were some minor changes to fix warnings on some compilers.
However from end-user perspective there should no big difference in sense of
container functionality.

- Will operator[]() block when adding a new cache item while all pre-existing
items are already in use
-- the short answer is : no, it will not.
the long one is next: concurrent_lru_cache does not limit number of objects
that are in use, instead it throws away extra _unused_ objects. (technically
speaking some blocking is inevitable as internally locks are used to keep
internal data structutres corects.)

- How do you recommend using it efficiently for large value_type's given that
value_functor_type returns the cache item by value? I'm not using C++11 yet so
move operators are out of the question.
-- the state of art is to use some kind of smart proxy objects like C++11
shared_ptr

Hope it helps :)

Leave a Comment

Please sign in to add a comment. Not a member? Join today