TMCache is a powerful and flexible caching library for iOS and macOS applications. It provides an efficient and easy-to-use solution for caching data, reducing network requests, and optimizing the performance of your app.


  • Sync and async cache operations
  • Supports both memory and disk caching
  • Customizable cache expiry and size limits
  • Automatic memory management and cleanup
  • Thread-safe operation


To integrate TMCache into your iOS or macOS project, follow these steps:

  1. Using CocoaPods:
  2. “`
    pod ‘TMCache’

  3. Carthage:
  4. “`
    github “tmblr/TMCache”

  5. Manual installation:
  6. Download the latest release from the GitHub repository. Drag and drop the TMCache folder into your Xcode project.


To start using TMCache in your project:

  1. Import the framework:
  2. “`
    import TMCache

  3. Create a cache instance:
  4. “`
    let cache = TMCache(name: “myCache”)

  5. Set and retrieve cached objects:
  6. “`
    // Set an object in cache
    cache.setObject(“Hello, world!”, forKey: “myKey”)

    // Retrieve an object from cache
    if let cachedObject = cache.object(forKey: “myKey”) as? String {

  7. Additional cache operations:
  8. “`
    // Remove object from cache
    cache.removeObject(forKey: “myKey”)

    // Clear all objects from cache

  9. Handle cache eviction:
  10. “`
    cache.setOnMemoryWarningBlock { cache in
    // Perform cleanup or eviction logic here


We welcome and appreciate contributions from the community. To contribute to TMCache, please follow these guidelines:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make necessary changes and commit your code.
  4. Submit a pull request.


TMCache is released under the Apache License 2.0. See LICENSE file for more details.


For any questions or concerns, you can reach us at