Comments (7)
https://github.com/opulencephp/Opulence/blob/1.0/src/Opulence/Views/Compilers/Fortune/Transpiler.php#L191
https://github.com/opulencephp/Opulence/blob/1.0/src/Opulence/Views/Compilers/Fortune/Transpiler.php#L209
Current cache == transpiled cache.
from opulence.
The view cache is caching a compiled view, which is dependent on the variables set within the view. So, if the view template is {{ $username }}
, this is transpiled to <?php echo htmlentities($username); ?>
. If users foo
and bar
load the page, the compiled views would be foo
and bar
. It's those compiled views that the cache is loading.
I think what you might be after is a cache for the transpiled view contents, which does not currently exist.
from opulence.
To further clarify - I think I need to split the caches out - one for transpiled contents and one for compiled contents. Currently, a single cache is being used, which means that we'll have to re-transpile a view for each combination of variable values. The transpiled cache should not be dependent on variables values - only the compiled cache should.
from opulence.
If users foo and bar load the page, the compiled views would be foo and bar. It's those compiled views that the cache is loading.
I think it is not.
view: resources/views/username.fortune.php
{{ $username }}
run 1:
$this->view = $this->viewFactory->createView("username");
$this->view->setVar('username', 'user1');
return new Response($this->viewCompiler->compile($this->view));
run 2:
$this->view = $this->viewFactory->createView("username");
$this->view->setVar('username', 'user2');
return new Response($this->viewCompiler->compile($this->view));
caches:
- tmp/framework/http/views/07ebd14baf059ebf079bd1903c5841fb
- tmp/framework/http/views/d76eb756c2678439cbc391330a3f9c28
content same
<?php echo $__opulenceFortuneTranspiler->sanitize($username); ?>
from opulence.
I think the confusion is with the fact that Transpiler
is (incorrectly) using an ICache
rather than some sort of transpiler cache, which wouldn't be dependent on variable values. ICache
is meant to grab a view object with evaluated contents (eg foo
). So, this is an oversight/bug.
from opulence.
Btw, on a sidenote - you've been a rockstar contributor! Thanks for all the PRs/help!!
from opulence.
The more I think about it, I think we might be able to just scrap the variable component of ICache
like you suggested. Let me think about this a little bit and make sure there's not something I'm missing with that approach.
from opulence.
Related Issues (20)
- Interface is used, but argument isn't type declared HOT 3
- Update components, tag version HOT 3
- unambiguous migration ordering during running migrations:down HOT 7
- Fixing phan issues HOT 4
- PSR-7 support HOT 4
- T_CLASS case in FileMigrationFinder.php appears to be broken HOT 1
- Deprecated annotations HOT 4
- Add support for using expressions in query builders HOT 1
- Package jeremeamia/superclosure is abandoned, you should avoid using it. Use opis/closure instead. HOT 1
- Remove deprecated method(s) for forward compatibiltiy HOT 3
- Improve `make:entity` and `make:datamapper` by inferring the database schema (tables/columns/relationships) automatically. HOT 4
- Migration HOT 3
- Not proper use of prepare statements in the sql repository example on documtentation page HOT 4
- Database relation support HOT 5
- Rewriting own SqlDataMapper classes HOT 4
- Fix bug that prevent non-HTTP_ and CONTENT_ headers from being sent in response
- Running `php apex app:runlocally` in Ubuntu does not work
- phpDocumentor problem HOT 12
- Spaces in Path cause passthru to fail for runlocally (possibly others) HOT 1
- Nice FW but too many dependency HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opulence.