There are no news in what you're experiencing....
A file in static wins over anything else: there is no code to execute and
the webserver is free to serve the file as soon as the request comes in.
Passing instead from the download function needs some code to be executed
(query on the db to find the file path) and the file to be streamed by
web2py.
Then there is the one streamed from the db that is the lowest, because you
need to do everything you did before plus retrieving the file content from
the database.
On Thursday, October 17, 2013 7:38:25 PM UTC+2, 黄祥 wrote:
>
> thank you so much for your detail explaination and example, anthony.
> testing result with your recommendation is 1 - 3 ms (result network time
> latency in chrome developer tools)
> code :
> rows = db(db.company.id == 1).select(cache = (cache.ram, 10))
> for row in rows:
> response.logo = IMG(_src=URL('static', 'logo/%s' % row.logo),
> _width="20px", _title=row.name, _class="brand")
>
> thanks and best regards,
> stifan
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.