# |
Apr 4th 2019, 13:40 |
ricksaccous |
thanks lol |
# |
Apr 4th 2019, 13:40 |
neon1024 |
LMGTFY |
# |
Apr 4th 2019, 13:40 |
neon1024 |
https://dev.to/jackmarchant/offset-and-cursor-pagination-explained-b89 |
# |
Apr 4th 2019, 13:39 |
neon1024 |
So you don’t load an entire result set |
# |
Apr 4th 2019, 13:39 |
neon1024 |
A cursor is like an offset |
# |
Apr 4th 2019, 13:38 |
ricksaccous |
just curious, haven't developed it |
# |
Apr 4th 2019, 13:38 |
ricksaccous |
like the load more types as you scroll or something? |
# |
Apr 4th 2019, 13:38 |
neon1024 |
Did anyone ever developer a cursor paginator for Cake? |
# |
Apr 4th 2019, 13:37 |
admad |
:bulb: |
# |
Apr 4th 2019, 13:37 |
neon1024 |
Oh right |
# |
Apr 4th 2019, 13:36 |
admad |
i presume you know how to get controller name from request instance :slightly_smiling_face: |
# |
Apr 4th 2019, 13:36 |
ricksaccous |
hehe |
# |
Apr 4th 2019, 13:36 |
ricksaccous |
https://api.cakephp.org/3.7/class-Cake.View.View.html#_getRequest |
# |
Apr 4th 2019, 13:36 |
ricksaccous |
yeah |
# |
Apr 4th 2019, 13:36 |
admad |
@neon1024 View class gets the request instance |
# |
Apr 4th 2019, 13:34 |
admad |
so set memcache and fallback for array and if not present in memcache too the ORM will query db |
# |
Apr 4th 2019, 13:34 |
ricksaccous |
misunderstood |
# |
Apr 4th 2019, 13:34 |
neon1024 |
Cake View class must know |
# |
Apr 4th 2019, 13:34 |
admad |
@val you can have fallback engine in cache configs |
# |
Apr 4th 2019, 13:34 |
ricksaccous |
ohhh my bad |
# |
Apr 4th 2019, 13:33 |
neon1024 |
As the implementation of View classes isn’t related |
# |
Apr 4th 2019, 13:33 |
neon1024 |
Which leads us back to my original question. |
# |
Apr 4th 2019, 13:33 |
neon1024 |
With a single view class I can set it in the prefixes app controller |
# |
Apr 4th 2019, 13:33 |
ricksaccous |
or whatever the method to set view class is |
# |
Apr 4th 2019, 13:33 |
ricksaccous |
also what? you would just need to do $this->viewBuidler()->setViewClass() in each controller method, which would be annoying |
# |
Apr 4th 2019, 13:32 |
neon1024 |
Then I would need a View class for each controller method. |
# |
Apr 4th 2019, 13:32 |
ricksaccous |
i dunno, there's prob a way to get the request in view class or something |
# |
Apr 4th 2019, 13:32 |
ricksaccous |
set the view class in the controller instead? lol |
# |
Apr 4th 2019, 13:31 |
neon1024 |
When creating a custom View class, how do I know the controller action? So I can properly switch between templates? |
# |
Apr 4th 2019, 13:29 |
val |
@admad Hmmm... That's pretty close but the query would not be persisted between requests. Is there a way to do something like `if not in array engine then get from memcached else get from database`? |
# |
Apr 4th 2019, 13:17 |
admad |
you can create cache config which use `ArrayEngine` which would be in memory |
# |
Apr 4th 2019, 13:16 |
val |
Or do I get it wrong? |
# |
Apr 4th 2019, 13:16 |
val |
@admad if I understood correctly that uses cache config, f.ex. memcached. In-memory-caching with `cacheQueries` in cake 2.x allows to minimize the number of hits to memcached. |
# |
Apr 4th 2019, 13:14 |
admad |
that allows you pretty much the same what you described |
# |
Apr 4th 2019, 13:14 |
admad |
@val https://book.cakephp.org/3.0/en/orm/query-builder.html#caching-query-results |
# |
Apr 4th 2019, 13:13 |
weto.jc |
@rochasmarcelo the connection works this way with pure php```$db = new mysqli("meubanco", "admin", "123456", "DATABASE_NAME");``` |
# |
Apr 4th 2019, 13:10 |
admad |
the right person to have this conversation with would be @lorenzo |
# |
Apr 4th 2019, 13:09 |
val |
@admad I think technically the final SQL is not really needed for in-memory-caching. The prepared statement and the query params could be json encoded, merged and md5'ed in order to generate the cache key. |
# |
Apr 4th 2019, 13:02 |
ricksaccous |
interesting |
# |
Apr 4th 2019, 13:02 |
admad |
before have you just have placeholders in the query |
# |
Apr 4th 2019, 13:01 |
admad |
@val with pdo prepared statements you can't have the final SQL until query is actually executed |