MemoryCache
        
        Query memory cache class.
    
    
 class Winter\Storm\Database\MemoryCacheStores query results in memory to avoid running duplicate queries
Traits
| Trait | Description | 
|---|---|
| Singleton | Singleton trait. | 
Properties
            
            
            
                protected
            
            
            $cache
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
        
        Cached results.
            
            
            
                protected
            
            
            $enabled
            
                :
                                                            bool
                                                                        
                        = true
                    
                            
        
        
        Store enabled state.
            
            
            
                protected
            
            
            $tableMap
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
        
        The mapper between hashed keys and table names.
Methods
            
            
            
                public
            
                        
            enabled ($switch = null)
                            : bool
                    
        
        Check if the memory cache is enabled.
Parameters
                | Property | Type | Description | 
|---|---|---|
| $switch | mixed | mixed | 
Returns
            bool
                public flush () : void
Clear the memory cache.
Returns
            void
                public forget (string $table) : void
Delete the cache for the given table.
Parameters
                | Property | Type | Description | 
|---|---|---|
| $table | string | string | 
Returns
            void
                public get (Winter\Storm\Database\QueryBuilder $query) : array | null
Get the cached results for the given query.
Parameters
                | Property | Type | Description | 
|---|---|---|
| $query | Winter\Storm\Database\QueryBuilder | Winter\Storm\Database\QueryBuilder | 
Returns
            array | null
                public has (Winter\Storm\Database\QueryBuilder $query) : bool
Check if the given query is cached.
Parameters
                | Property | Type | Description | 
|---|---|---|
| $query | Winter\Storm\Database\QueryBuilder | Winter\Storm\Database\QueryBuilder | 
Returns
            bool
                public put (Winter\Storm\Database\QueryBuilder $query, array $results) : void
Store the results for the given query.
Parameters
                | Property | Type | Description | 
|---|---|---|
| $query | Winter\Storm\Database\QueryBuilder | Winter\Storm\Database\QueryBuilder | 
| $results | array | array | 
Returns
            void
                protected hash (Winter\Storm\Database\QueryBuilder $query) : string
Calculate a hash key for the given query.
Parameters
                | Property | Type | Description | 
|---|---|---|
| $query | Winter\Storm\Database\QueryBuilder | Winter\Storm\Database\QueryBuilder | 
Returns
            string
                inherited public __clone ()
                Inherited from
                
                    Singleton
                
            
        
        Returns
            mixed
                inherited public __wakeup ()
                Inherited from
                
                    Singleton
                
            
        
        Returns
            mixed
                
            
                            
                    inherited
                
            
            
                public
            
                            
                    static
                
                                        
                    final
                
            
            forgetInstance ($container = null)
                            : void
                    
                    
                Inherited from
                
                    Singleton
                
            
        
        Forget this singleton's instance if it exists
Parameters
                | Property | Type | Description | 
|---|---|---|
| $container | mixed | mixed | 
Returns
            void
                
            
                            
                    inherited
                
            
            
                public
            
                            
                    static
                
                                        
                    final
                
            
            instance ($container = null)
                            : static
                    
                    
                Inherited from
                
                    Singleton
                
            
        
        Create a new instance of this singleton.
Parameters
                | Property | Type | Description | 
|---|---|---|
| $container | mixed | mixed | 
Returns
            static
                inherited protected final __construct ()
                Inherited from
                
                    Singleton
                
            
        
        Constructor.
Returns
            mixed
                inherited protected init ()
                Inherited from
                
                    Singleton
                
            
        
        Initialize the singleton free from constructor parameters.
Returns
            mixed
                
            
            ← Previous page
            Winter\Storm\Database\Dongle
        
                
            Next page →
            Winter\Storm\Database\MigrationServiceProvider
        
    
    Copyright © 2025 Winter CMS