Skip to main content

High-performance in-memory caching library with TTL, LRU eviction, and persistence.

Project description

📦 Atikin-Cache

⚡ High-performance in-memory caching library with TTL, LRU eviction, thread-safety, and persistence. Created By: Atikin Verse.

License Python Tests Made by Atikin Verse


🚀 Features

  • Time-to-live (TTL): Automatic expiration of cached items
  • 🔄 LRU eviction: Least Recently Used items removed when cache is full
  • 🧵 Thread-safe: Safe for multi-threaded applications
  • 💾 Persistence: Save and load cache data from disk
  • High performance: O(1) read/write operations, minimal overhead

📥 Installation

pip install atikin-cache

Or install from source:

git clone https://github.com/atikinverse/atikin-cache.git
cd atikin-cache
pip install .

📖 Usage

🔹 Basic Example

from atikin_cache import AtikinCache

# Create cache with max 1000 items and 5-minute default TTL
cache = AtikinCache(maxsize=1000, default_ttl=300)

# Set a value
cache.set('user:123', {'name': 'John', 'email': 'john@example.com'})

# Get a value
user = cache.get('user:123')
print(user)  # {'name': 'John', 'email': 'john@example.com'}

# Custom TTL
cache.set('temp:data', 'temporary', ttl=10)  # 10 seconds

# Check existence
if cache.exists('user:123'):
    print("User exists in cache")

# Delete key
cache.delete('user:123')

# Clear cache
cache.clear()

🔹 Persistent Cache

# Create cache with persistence
cache = AtikinCache(persist_path='/path/to/cache.dat')

# Store data
cache.set('key', 'value')

# Save to disk
cache.save_to_disk()

# Load from disk
cache.load_from_disk()

🧪 Testing

Run the full test suite:

python -m unittest discover tests

Run the example:

python examples/basic_usage.py

⚡ Performance

  • O(1) for get, set, delete operations
  • Optimized for minimal locking in multi-threaded environments
  • Efficient memory usage with LRU eviction

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🌐 Follow Us

Platform Username
Facebook atikinverse
Instagram atikinverse
LinkedIn atikinverse
Twitter/X atikinverse
Threads atikinverse
Pinterest atikinverse
Quora atikinverse
Reddit atikinverse
Tumblr atikinverse
Snapchat atikinverse
Skype atikinverse
GitHub atikinverse

Made with ❤️ by Atikin Verse 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atikin-cache-1.0.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atikin_cache-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file atikin-cache-1.0.0.tar.gz.

File metadata

  • Download URL: atikin-cache-1.0.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for atikin-cache-1.0.0.tar.gz
Algorithm Hash digest
SHA256 82aefca89fdf5769d05643e70e6e1463b8984daf58f77770ece9d896cd11decd
MD5 d58f047ac3676779d4ec02bd556c38a2
BLAKE2b-256 99a0064f5e63dc1a5c256448d5cddc52c12c819239318c52404b5449e1d9d269

See more details on using hashes here.

File details

Details for the file atikin_cache-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: atikin_cache-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for atikin_cache-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34c0c0764395789dbbf13cf4a957fe2f117602323e66f0862390dc8304dada13
MD5 2e1d1c474da90aae246e30bd16a72d28
BLAKE2b-256 5b9e7dc6fd741f2b83486f4e577658039097081643187b2da020c2bd481eb77b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page