pvanand commited on
Commit
e3cfbf6
1 Parent(s): e81c7e9

Update document_generator.py

Browse files
Files changed (1) hide show
  1. document_generator.py +23 -1
document_generator.py CHANGED
@@ -277,4 +277,26 @@ async def generate_document_endpoint(request: DocumentRequest):
277
  markdown_document=markdown_document
278
  )
279
  except Exception as e:
280
- raise HTTPException(status_code=500, detail=str(e))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  markdown_document=markdown_document
278
  )
279
  except Exception as e:
280
+ raise HTTPException(status_code=500, detail=str(e))
281
+
282
+ class CacheTestResponse(BaseModel):
283
+ result: str
284
+ execution_time: float
285
+
286
+ @router.get("/test-cache/{test_id}", response_model=CacheTestResponse)
287
+ @cache(expire=60) # Cache for 1 minute
288
+ async def test_cache(test_id: int):
289
+ start_time = time.time()
290
+
291
+ # Simulate some time-consuming operation
292
+ await asyncio.sleep(2)
293
+
294
+ result = f"Test result for ID: {test_id}"
295
+
296
+ end_time = time.time()
297
+ execution_time = end_time - start_time
298
+
299
+ return CacheTestResponse(
300
+ result=result,
301
+ execution_time=execution_time
302
+ )