apple / apple/swift-algorithms

FR: Add a LRU Cache debatable and predictable. wit

Open
#231 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
6.3k
Forks
483
PR merge metrics
No merged PRs in 30d

Description

Hi Community,

I’ve been exploring the inner workings of NSCache and found it to be somewhat unpredictable and challenging to debug, lacking robust methods for effective cache management.

This led me to wonder: would it be feasible to introduce a thread-safe, manageable, and predictable LRUCache that can listen for system low memory warnings and respond according to customizable configurations? The key requirement is that this cache should remain in memory and not be evicted when the system goes into the background or the device is locked.

Creating a custom cache or relying on third-party solutions is quite cumbersome. In my opinion, Apple should address this gap. It’s increasingly uncommon for apps not to require such in-memory caching capabilities.

It would be great to develop a solution here, and perhaps Apple could eventually integrate it into the Foundation framework.

Best.

Contributor guide

Open the contributing guide

Research direction

No source files, tests, or entry points are identified. Start by reviewing the package structure and existing collection or caching-related APIs, then determine the scope and requirements for a thread-safe, predictable LRU cache with configurable low-memory behavior; done criteria are not defined in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.