Skip to content

Commit 88e1d10

Browse files
committed
adding info to the cache branch
1 parent a4e3b99 commit 88e1d10

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
This is a Python web app using the Django framework and the Azure Database for PostgreSQL relational database service. The Django app is hosted in a fully managed Azure App Service. This app is designed to be be run locally and then deployed to Azure. You can either deploy this project by following the tutorial [*Deploy a Python (Django or Flask) web app with PostgreSQL in Azure*](https://docs.microsoft.com/azure/app-service/tutorial-python-postgresql-app) or by using the [Azure Developer CLI (azd)](https://learn.microsoft.com/azure/developer/azure-developer-cli/overview) according to the instructions below.
44

5+
## The Cache branch
6+
The Cache branch in the repository contains sample code to save web response out and user session data in a Redis Cache. For web response caching, if a user clicks into the detailed view of a resturant, the details page will be cached for 60 seconds. This increases the application performance by saving server resource and reducing dependency calls into the PostgreSQL. For user session data such as last viewed restaurant, saving in Redis Cache improves consistency and resiliency comparing with in-memory.
7+
Files changed in the Cache branch:
8+
* ./azureproject/production.py and settings.py - added cache and session middlewares
9+
* ./restaurant_review/views.py - added @cache_page tag and session data "lastViewedRestaurant"
10+
* ./restaurant_review/templates/restaurant_review/index.html - added display for 'LastViewedRestaurant'
11+
512
## Requirements
613

714
The [requirements.txt](./requirements.txt) has the following packages:

infra/resources.bicep

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,20 +321,8 @@ resource redisCache 'Microsoft.Cache/redis@2023-04-01' = {
321321
enableNonSslPort:false
322322
redisVersion:'6'
323323
publicNetworkAccess:'Disabled'
324-
//subnetId:virtualNetwork::cacheSubnet.id //commented out b/c vnet injection only works for premium skus
325324
}
326325

327-
// resource redisCacheNetwork 'privateEndpointConnections' = {
328-
// name: '${cacheServerName}-privateEndpointConnection'
329-
// properties:{
330-
// privateLinkServiceConnectionState: {
331-
// actionsRequired: 'Change on the service provider will require updates on the consumer. see https://learn.microsoft.com/en-us/azure/templates/microsoft.cache/redis/privateendpointconnections?pivots=deployment-language-bicep#privatelinkserviceconnectionstate'
332-
// description: 'the private link service connection state for setting up private link'
333-
// status: 'Approved'
334-
// }
335-
// privateEndpoint: cachePrivateEndpoint
336-
// }
337-
// }
338326

339327
}
340328

0 commit comments

Comments
 (0)