Mixins¶
YAPFM mixins provide modular functionality to extend file manager capabilities. Each mixin can be used independently or in combination with other mixins.
Available Mixins¶
Core Mixins¶
- FileOperationsMixin - Basic file operations
- KeyOperationsMixin - Key-based data access with dot notation
- SectionOperationsMixin - Section-based data management
- ContextMixin - Context manager for automatic loading/saving
- Batch Operations - Efficient batch operations for multiple keys
Performance Mixins¶
- CacheMixin - Intelligent caching with TTL and LRU eviction
- LazySectionsMixin - Lazy loading of sections
- StreamingMixin - Large file processing
Analysis and Search Mixins¶
- AnalysisMixin - Data analysis and statistics
- SearchMixin - Search in keys and values
Transformation Mixins¶
- TransformMixin - Data transformation and restructuring
- CleanupMixin - Data cleanup (removing nulls, empty sections)
Advanced Management Mixins¶
- MultiFileMixin - Multi-file management and merging
- CloneMixin - Data cloning and copying
- ExportMixin - Export to different formats
- SecurityMixin - Security and sensitive data masking
Usage¶
Mixins are automatically included in YAPFileManager and can be used directly:
from yapfm import YAPFileManager
# All mixins are available
fm = YAPFileManager("config.json")
# Using mixin functionality
fm.set_key("value", dot_key="database.host") # KeyOperationsMixin
fm.set_value("key", "value") # CacheMixin
fm.get_stats() # AnalysisMixin
fm.search_in_values("localhost") # SearchMixin
Architecture¶
Mixins follow the composition pattern and are designed to be: - Modular: Each mixin has a specific responsibility - Composable: Can be combined as needed - Thread-safe: Safe for concurrent usage - Performant: Optimized for frequent operations