Community
cancel
Showing results for 
Search instead for 
Did you mean: 
e4lam
Beginner
215 Views

Documentation/examples for concurrent_lru_cache?

Jump to solution
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!
0 Kudos
1 Solution
215 Views
I've updated reference.pdf on the site.
--Vladimir

View solution in original post

8 Replies
SergeyKostrov
Valued Contributor II
215 Views
Quoting e4lam
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!


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

215 Views
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 appreciated
Thanks!
Vladimir
e4lam
Beginner
215 Views
e4lam
Beginner
215 Views
@Sergey: As mentioned, it can be found in the sources for TBB 4 update 2. The corresponding commercially aligned OSS version is tbb40_278oss
215 Views
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
216 Views
I've updated reference.pdf on the site.
--Vladimir

View solution in original post

e4lam
Beginner
215 Views
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!
Anton_P_Intel
Employee
215 Views
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 :)
Reply