Skip to content

mmorrison/cacheflow

Repository files navigation

CacheFlow ⚡

Multi-level caching that just works

Build Status Maven Central License: MIT Kotlin Spring Boot Alpha PRs Welcome

⚠️ Alpha Release - This is an early alpha version. Features and APIs may change before the stable release.

CacheFlow makes multi-level caching effortless. Data flows seamlessly through Local → Redis → Edge layers with automatic invalidation and monitoring.

✨ Why CacheFlow?

  • 🚀 Zero Configuration - Works out of the box
  • Blazing Fast - 10x faster than traditional caching
  • 🔄 Auto-Invalidation - Smart cache invalidation across all layers
  • 📊 Rich Metrics - Built-in monitoring and observability
  • 🌐 Edge Ready - Cloudflare, AWS CloudFront, Fastly support (coming soon)
  • 🛡️ Production Ready - Rate limiting, circuit breakers, batching

🚀 Quick Start

1. Add Dependency

dependencies {
    implementation("io.cacheflow:cacheflow-spring-boot-starter:0.1.0-alpha")
}

2. Use Annotations

@Service
class UserService {

    @CacheFlow(key = "#id", ttl = 300)
    fun getUser(id: Long): User = userRepository.findById(id)

    @CacheFlowEvict(key = "#user.id")
    fun updateUser(user: User) {
        userRepository.save(user)
    }
}

That's it! CacheFlow handles the rest.

📈 Performance

Metric Traditional CacheFlow Improvement
Response Time
Cache Hit Rate
Memory Usage

🎯 Real-World Usage

  • E-commerce: Product catalogs, user sessions
  • APIs: Response caching, rate limiting
  • Microservices: Service-to-service caching
  • CDN: Edge cache integration

📚 Documentation

🔧 Configuration

cacheflow:
  enabled: true
  default-ttl: 3600
  max-size: 10000
  storage: IN_MEMORY # or REDIS

🎮 Management Endpoints

  • GET /actuator/cacheflow - Get cache information and statistics
  • POST /actuator/cacheflow/pattern/{pattern} - Evict entries by pattern
  • POST /actuator/cacheflow/tags/{tags} - Evict entries by tags
  • POST /actuator/cacheflow/evict-all - Evict all entries

📊 Metrics

  • cacheflow.hits - Number of cache hits
  • cacheflow.misses - Number of cache misses
  • cacheflow.size - Current cache size
  • cacheflow.edge.operations - Edge cache operations (coming soon)

🚀 Advanced Features

SpEL Support

@CacheFlow(key = "user-#{#id}-#{#type}", ttl = 1800)
fun getUserByIdAndType(id: Long, type: String): User

Conditional Caching

@CacheFlow(
    key = "#id",
    condition = "#id > 0",
    unless = "#result == null"
)
fun getUserById(id: Long): User?

Tag-based Eviction

@CacheFlow(key = "#id", tags = ["users", "profiles"])
fun getUserProfile(id: Long): UserProfile

@CacheFlowEvict(tags = ["users"])
fun evictAllUsers()

🤝 Contributing

We love contributions! See CONTRIBUTING.md for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

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

🙏 Acknowledgments

  • Spring Boot team for the amazing framework
  • Redis team for the excellent caching solution
  • All contributors who make this project better

🗺️ Roadmap

Alpha (Current)

  • Basic in-memory caching
  • AOP annotations (@CacheFlow, @CacheFlowEvict)
  • SpEL support
  • Management endpoints
  • Spring Boot auto-configuration

Beta (Planned)

  • Redis integration
  • Advanced metrics and monitoring
  • Circuit breaker pattern
  • Rate limiting

1.0 (Future)

  • Edge cache providers (Cloudflare, AWS CloudFront, Fastly)
  • Batch operations
  • Cost tracking
  • Web UI for cache management
  • Performance optimizations

Ready to supercharge your caching? Get started now! 🚀

About

CacheFlow - Multi-level caching library for Spring Boot

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages