Advertisement
Guest User

Erlang module

a guest
Mar 26th, 2024
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.51 KB | Software | 0 0
  1.  
  2.  
  3. -module(content).
  4. -export([get/1, locate/2]).
  5.  
  6. -define(cached, []).
  7.  
  8. get(content) ->
  9.     % receive tcp signal asking for content
  10.     try locate_content(cached, content) of
  11.         {etag, l_content} when length(etag) > 0 ->
  12.             % send HTTP response with the content
  13.             merge(cached, [{gen_etag(l_content), l_content}]);
  14.             %socket(content).
  15.     catch
  16.         Empty ->
  17.             io:fwrite("Content not found");
  18.     end.
  19.  
  20. locate(content, index = 0) ->
  21.     Result = Empty
Tags: Erlang
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement