Safe Haskell | None |
---|
A file server for frequently accessed files, such are static web pages and image decorations, icons etc
that are cached (memoized) according with the Data.TCache policies in the program space. This avoid the blocking of
the efficient GHC threads by frequent IO calls.So it enhances the performance
in the context of heavy concurrence.
It uses Memoization
.
The caching-uncaching follows the setPersist
criteria.
- addFileServerWF :: IO ()
- linkFile :: String -> String
- setFilesPath :: String -> IO ()
Documentation
addFileServerWF :: IO ()Source
Is the flow to be added to the list in order to stream any file from the filesystem for example, images
This app includes the fileServe flow:
main= do addFileServerWF addMessageFlows messageFlows run 80 hackMessageFlow adminLoop where messageFlows= [("noscript" , transient $ runFlow showStories) ,(admin" , transient $ runFlow admin) ,(mail" , transient $ runFlow mail)]
Add the fileServer to the list of server flows
linkFile :: String -> StringSource
Creates the url of file path. To be used in ordinary links to files. in Text.XHtml, a image would be embeded as
image ![src $ linkFile imagepath]
in HSP:
<img src=(linkFile imagepath)\>
Given the relative path of a file, it return the content of the href
element in a html link
setFilesPath :: String -> IO ()Source
Set the path of the files in the web server. The links to the files are relative to it