Manager & Factories 管理者和工厂

Laravel has several Manager classes that manage the creation of driver-based components. These include the cache, session, authentication, and queue components. The manager class is responsible for creating a particular driver implementation based on the application's configuration. For example, the CacheManager class can create APC, Memcached, Native, and various other implementations of cache drivers.

Laravel 有好多 Manager 类用来管理基于驱动的组件的生成过程。基于驱动的组件包括:缓存、会话、身份认证、队列组件等。管理类负责根据应用程序的配置,来生成特定的驱动实例。比如:CacheManager 可以创建 APC、Memcached、Native、还有其他不同的缓存驱动的实现。

Each of these managers includes an extend method which may be used to easily inject new driver resolution functionality into the manager. We'll cover each of these managers below, with examples of how to inject custom driver support into each of them.

每个管理类都包含名为 extend 的方法,该方法可用于将新功能注入到管理类中。下面我们将逐个介绍管理类,为你展示如何注入自定义的驱动。

Learn About Your Managers 如何了解你的管理类

Take a moment to explore the various Manager classes that ship with Laravel, such as the CacheManager and SessionManager. Reading through these classes will give you a more thorough understanding of how Laravel works under the hood. All manager classes extend the Illuminate\Support\Manager base class, which provides some helpful, common functionality for each manager.

请花点时间看看 Laravel 中各个 Manager 类的代码,比如 CacheManager 和 SessionManager 。通过阅读这些代码能让你对 Laravel 的管理类机制更加清楚透彻。所有的管理类都继承自 Illuminate\Support\Manager 基类,该基类为每一个管理类提供了一些有效且通用的功能。

results matching ""

    No results matching ""