# CachingPool-like object that caches objects instead of closures?

**URL:** <https://discourse.julialang.org/t/cachingpool-like-object-that-caches-objects-instead-of-closures/56371>\
**Category:** General Usage\
**Created:** [March 2, 2021, 10:50pm UTC](https://discourse.julialang.org/t/cachingpool-like-object-that-caches-objects-instead-of-closures/56371 "2021-03-02T22:50:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)\
**Post date:** [March 2, 2021, 10:50pm UTC](https://discourse.julialang.org/t/cachingpool-like-object-that-caches-objects-instead-of-closures/56371/1 "2021-03-02T22:50:06Z")

</div>

From what I can tell, CachingPool caches things at the level of the closure, so if you have multiple closures using the same “big” object, it gets sent twice. E.g.

```julia
function foo(pool)
    dat = BigObject(...)
    pmap(workers()) do i
        something(dat)
    end
    pmap(workers()) do i
        something_else(dat)
    end
end

pool = CachingPool(workers())
foo(pool) # dat will be sent twice 

```

Does anything exist that would cache at the level of the object, so that `dat` is only sent once? I’m aware that auto-global-shipping would work, but is there a solution that doesn’t rely on a global state?
