【发布时间】:2014-12-10 14:15:21
【问题描述】:
我的 Laravel 缓存系统有问题(我使用 Laravel 4.1)。
- 在我的本地服务器上,Laravel 所在的“app/storage”文件夹 存储缓存的文件具有 755 权限。
- 在我的生产服务器上,相同的文件夹拥有相同的权限 代码。
- 在我的本地服务器上,当我使用 Laravel 的缓存缓存数据时 类,有效。所以如果我进入“app/storage”文件夹,我可以看到 创建的文件。
- 在我的生产服务器上,它没有.. 文件没有创建在
“app/storage”中的缓存文件夹,而会话和视图
文件夹(存在于应用程序/存储中)存储了文件。我可以确认
因为它总是使用
has方法进入我的if 语句,即使我使用缓存类的put方法放置我的$datas。
编辑
/*
|--------------------------------------------------------------------------
| Default Cache Driver
|--------------------------------------------------------------------------
|
| This option controls the default cache "driver" that will be used when
| using the Caching library. Of course, you may use other drivers any
| time you wish. This is the default when another is not specified.
|
| Supported: "file", "database", "apc", "memcached", "redis", "array"
|
*/
'driver' => 'file',
/*
|--------------------------------------------------------------------------
| File Cache Location
|--------------------------------------------------------------------------
|
| When using the "file" cache driver, we need a location where the cache
| files may be stored. A sensible default has been specified, but you
| are free to change it to any other place on disk that you desire.
|
*/
'path' => storage_path(). DIRECTORY_SEPARATOR . 'cache',
/*
|--------------------------------------------------------------------------
| Database Cache Connection
|--------------------------------------------------------------------------
|
| When using the "database" cache driver you may specify the connection
| that should be used to store the cached items. When this option is
| null the default database connection will be utilized for cache.
|
*/
'connection' => null,
/*
|--------------------------------------------------------------------------
| Database Cache Table
|--------------------------------------------------------------------------
|
| When using the "database" cache driver we need to know the table that
| should be used to store the cached items. A default table name has
| been provided but you're free to change it however you deem fit.
|
*/
'table' => 'cache',
/*
|--------------------------------------------------------------------------
| Memcached Servers
|--------------------------------------------------------------------------
|
| Now you may specify an array of your Memcached servers that should be
| used when utilizing the Memcached cache driver. All of the servers
| should contain a value for "host", "port", and "weight" options.
|
*/
'memcached' => array(
array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),
),
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => 'laravel',
你知道我做错了什么吗?
【问题讨论】:
-
您能告诉我们
/app/config/cache.php或您正在使用的任何其他缓存配置文件吗? -
我编辑我的帖子向您展示我的配置文件。
-
缓存是否在生产站点上工作?它是否存储数据?
-
一点也不,当我在缓存数据后使用 if 语句检查数据是否已存储时,脚本仍会继续进入“if”,如果我转储数据缓存,它给我一个错误,说缓存键不存在
-
755 表示所有者为 7,组为 5,其他为 5。您确定用于创建存储文件夹的用户与运行 apache 的用户相同吗?否则 apache 将无法访问该文件夹。
标签: php laravel caching laravel-4