Heads up! We're sunsetting this forum to streamline our community space.

join us on Discord for support, updates, and all things Snap AR! See you there!
Sign up for our live Camera Kit office hour on July 17 @ 9:30am (PT) / 4:30pm (GMT)

Clean Lenses repository cache

Jorge Costa
Jorge Costa Posts: 13 πŸ”₯

How can we clean programmatically the lenses repository cache?

Also, is it memory cache, disk cache, or both?

Thanks in advance!

Tagged:

Comments

  • stevenxu
    stevenxu Posts: 612 πŸ‘»

    @arashp when you get a chance!

  • arashp
    arashp Posts: 52 πŸ”₯πŸ”₯

    Thanks @stevenxu, @Jorge Costa

    The lens repository is written to disk. It is refreshed every 12 hours or on every app launch. There is an API for determining the size of the cache: SCCameraKitCacheConfig. But there is no API for cleaning or invalidating the cache.

    Could you tell us a little more about the use case?

  • Jorge Costa
    Jorge Costa Posts: 13 πŸ”₯

    Thanks.

    Yes, SCCameraKitCacheConfig was the only thing I found related, but it doesn't help.

    We started monitoring our memory usage on the app better, and since we have a ScrollView for our users to preview our lenses, it's possible to load and apply several lenses in a matter of seconds.

    We notice that SCCameraKit doesn't clean everything from memory when we change from one lens to another. We also tried to use the `clearΒ΄ method from the lens processor; it helped a bit, but we still see the memory increasing and not being totally cleaned.

    We see the same behavior on the CameraKitSample.

    That's why I'm asking if it's possible to add a method to get a better cleaning.

  • arashp
    arashp Posts: 52 πŸ”₯πŸ”₯
    edited April 16 #5

    Hi @Jorge Costa -- thanks for explaining the use case. We do expect the overall memory footprint to increase until all Lenses are cached or until the app hits the Lens cache size limit. And yes clear does just clears the currently applied Lens.

    We will need to investigate further if you find the memory footprint increases beyond the cache size limit.

    I will pass on the request for clearing the cache to the team. Thanks again!

Categories