未定义的Laravel路径调用(Undefined Laravel path calls)
作为Laravel的首发,我遇到了以下问题:“框架调用给出了一个未定义的调用错误”。
运行版本:5.2.14
https://laravel.com/docs/5.0/helpers#paths
base_path获取应用程序安装根目录的完全限定路径。
config_path获取config目录的完全限定路径。
public_path获取公共目录的完全限定路径。
storage_path获取存储目录的标准路径。
看来我的intellisense正在看这些方法。 但是,当我打电话给他们时,它给我带来了未定义的方法错误。 我的home.blade.php文件:
<?php $storage_path = storage_path(); echo $storage_path ?>
将导致:致命错误:调用未定义的函数storage_path()
As a Laravel starter I am stuck with the following problem: "Framework calls are giving a Undefined Call error".
running version: 5.2.14
https://laravel.com/docs/5.0/helpers#paths
base_path Get the fully qualified path to the root of the application install.
config_path Get the fully qualified path to the config directory.
public_path Get the fully qualified path to the public directory.
storage_path Get the fully qualified path to the storage directory.
It seems my intellisense is seeing these methodes. But when I do call them it is giving me a hard time with undefined methode errors. My home.blade.php file:
<?php $storage_path = storage_path(); echo $storage_path ?>
Will result in: Fatal error: Call to undefined function storage_path()
原文:https://stackoverflow.com/questions/35242384
最满意答案
二级缓存的生命周期与会话工厂相关联,而不是与单个会话相关联。 一旦实体通过其唯一ID加载并且第二级缓存处于活动状态,该实体可用于(同一会话工厂的)所有其他会话。
因此,第二级仅适用于同一会话工厂的会话。
请查看NHibernate中的第一级和第二级缓存以获取更多详细信息
The life time of the second level cache is tied to the session factory and not to an individual session. Once an entity is loaded by its unique id and the second level cache is active the entity is available for all other sessions (of the same session factory).
So 2nd level works only thru sessions of the same session factory.
Please look First and Second Level caching in NHibernate for more details
相关问答
更多-
Ayende在NHibernate中介绍了二级缓存的使用情况。 您将需要在Web场景中使用分布式缓存。 例如SysCache2(依赖于ASP.NET缓存,可以配置为使用分布式提供程序)或MemCache。 这里有一篇文章说明如何配置memcached。 Ayende blogged about 2nd level cache usage in NHibernate. You will need to use a distributed cache in a web farm scenario. For ex ...
-
sJHony我找到了解决方案,但对我来说更像是解决方法。 因此,如果你知道任何其他解决方案给我签名。 我利用QueryOver 没有任何转换 ,这个解决方案的错误在于查询返回的元素等于childs。 接下来,我使用distinct在内存中检索不是相乘的列表。 这个解决方案没问题,但是当我们再添加一个Fetch进行查询时,对象中的集合也会成倍增加,这就是我将集合类型从IList(Bag)修改为ISet(Set)的原因。 代码如下: var queryCacheResult = ...
-
他们访问的数据存在一些重叠,因此需要共享二级缓存。 可能吗? 这将需要(这很可能过于简化): 能够从Java和.Net访问缓存。 为(N)Hibernate提供缓存提供程序实现。 能够以与两种语言兼容的格式读/写数据(或者没有共同的高速缓存)。 这听起来可行但是: 我不知道现有的即用型解决方案实现这个(我的第一个想法是Memcache,但AFAIK Memcache存储了数据的序列化版本,所以这不符合最重要的要求#3)。 我想知道使用语言中性格式来存储数据不会产生太多开销(并以某种方式破坏了使用缓存的目的) ...
-
为什么NHibernate不会在第二次请求时使用二级缓存?(Why will NHibernate not use 2nd level cache on second request?)[2022-05-14]
您应该在事务中运行它并在最后提交事务。 仅当事务已成功提交时,NHibernate才会更新二级缓存。 如果你没有启动NHibernate事务,NHibernate将不知道结果是否足以被缓存。 You should run this in a transaction and commit the transaction at the end. NHibernate updates the 2nd level cache only if the transaction has been committed su ... -
你确定你的实体在二级缓存中吗? 通常你必须在事务中工作和查询,以便二级缓存做任何事情。 are you sure that your entities are in the 2nd level cache. Normally you have to be working and querying within transactions in order for the 2nd level cache to do anything.
-
您正在缓存查询结果,但不缓存您的实体(这些是单独的缓存)缓存查询的结果只存储ID; 如果你也没有缓存你的实体,那么会发出一个查询来加载每个返回的实体(这通常是坏的)MyDTO类的默认表名是MyDTO,所以它看起来就像这看起来像一个按ID查询,你不应该使用松散的命名查询,而应该使用正确的加载器。 (见17.4。加载自定义SQL)一旦设置了加载器和实体缓存,你就可以只使用session.Get(id)来检索你的对象,它将使用二级缓存,只要你在交易中完成所有工作,这是一种推荐的做法。 You are cachin ...
-
使用Redis的NHibernate二级缓存与仅使用Redis(NHibernate second-level cache using Redis vs just using Redis)[2022-05-18]
我看到两个不同的东西作为你的观点的摘要: 使用redis作为NHB上方的二级缓存。 这非常有意义,因为SLC存储了对象的分隔字段,而redis是键/值存储。 我记得,SLC包含标量查询或映射和获取对象的结果,但重要的是,数据是从执行的查询中获取(缓存)的。 恕我直言,如果您以这种方式使用redis,所有缓存的值必须来自NHB查询。 这为您带来了某种事务原子性,您是如何描述的,但据我所知,当SCL从未提交的事务中返回陈旧数据或数据时,我们发现了一些错误。 请注意,这种方法表明某人(NHB)仍然需要以某种方式保 ... -
config.Cache(x => x.Not.UseSecondLevelCache()); 解决了我的问题。 它删除了所有日志和不必要的cpu周期。 这是通过流利的。 如果您正在使用配置,则可能需要以下配置。
false config.Cache(x => x.Not.UseSecondLevelCache()); solved my problem. It removed a ... -
任何人都可以为Java EE 6应用程序推荐一个好的第二级对象缓存解决方案 虽然L2缓存合约在JPA 2.0中是标准化的,但L2缓存实现是特定于供应商的,您可能会也可能不会插入不同的L2缓存。 以防万一,请参阅第19.2章。 Hibernate的二级缓存 (正如您将看到的,问题没有一个答案,选择一个或另一个实现取决于您的需求和您使用缓存的方式)。 我特别担心必须将缓存客户端作为单线程/单例bean运行。 是这样的吗? 如果是这样,这是一个问题吗? 我不明白这个问题。 您不必担心任何事情,JPA提供程序与缓存 ...
-
NHibernate的二级缓存如何与连接提供程序一起工作?(How does NHibernate's 2nd level cache work with a connection provider?)[2023-05-25]
二级缓存的生命周期与会话工厂相关联,而不是与单个会话相关联。 一旦实体通过其唯一ID加载并且第二级缓存处于活动状态,该实体可用于(同一会话工厂的)所有其他会话。 因此,第二级仅适用于同一会话工厂的会话。 请查看NHibernate中的第一级和第二级缓存以获取更多详细信息 The life time of the second level cache is tied to the session factory and not to an individual session. Once an entity ...